Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ loop during local development.
```sh
cd /path/to/dir
DIR=/path/to/scip-typescript "$DIR/node_modules/.bin/tsx" "$DIR/src/main.ts" index # add --yarn-workspaces if applicable
lsif-typed index.scip > dump.lsif # from github.com/sourcegraph/sourcegraph/lib/codeintel/tools/lsif-typed
lsif-java snapshot-lsif # from github.com/sourcegraph/lsif-java
scip snapshot # from github.com/sourcegraph/scip
```

## Publishing a release
Expand Down
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,6 @@ index --no-global-caches REST_OF_THE_COMMAND`. By default, scip-typescript
`node --max-old-space-size=16000 "$(which scip-typescript)" index REST_OF_COMMAND`.
Replace 16000 with an even larger number if your computer has bigger RAM.

## Migrating from lsif-node

Before creating scip-typescript, we used another TypeScript indexer called
[lsif-node](https://github.com/sourcegraph/lsif-node). We recommend migrating
to scip-typescript if you are using lsif-node.

Follow the steps below to migrate from lsif-node to scip-typescript:

- Replace usages of the `lsif-tsc -p ARGUMENTS` command with `scip-typescript index ARGUMENTS`.
- Upgrade to the latest version of the `src` command-line interface, which you
can install via `yarn global add @sourcegraph/src`. It’s okay if the version
of your `src` command-line interface does not match the version of your
Sourcegraph instance.

## Contributing

See [Development.md](./Development.md) for docs on how to work on this project.
Expand Down
300 changes: 0 additions & 300 deletions snapshots/input/syntax/dump.svg

This file was deleted.

4 changes: 2 additions & 2 deletions src/FileIndexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export class FileIndexer {
if (isDefinitionNode) {
this.addSymbolInformation(node, sym, declaration, scipSymbol)
this.handleObjectBindingPattern(node, range)
// Only emit one symbol for definitions sites, see https://github.com/sourcegraph/lsif-typescript/issues/45
// Only emit one symbol for definitions sites, see https://github.com/sourcegraph/scip-typescript/issues/45
break
}
}
Expand Down Expand Up @@ -732,7 +732,7 @@ export class FileIndexer {
return this.scipSymbol(decl)
}
} catch {
// TODO: https://github.com/sourcegraph/lsif-typescript/issues/34
// TODO: https://github.com/sourcegraph/scip-typescript/issues/34
// continue regardless of error, the TypeScript compiler tends to
// trigger stack overflows in getTypeOfSymbolAtLocation and we
// don't know why yet.
Expand Down
4 changes: 2 additions & 2 deletions src/Range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class Range {
}
return this.end.compare(other.end)
}
public toLsif(): number[] {
public toPackedRange(): number[] {
if (this.isSingleLine()) {
return [this.start.line, this.start.character, this.end.character]
}
Expand All @@ -25,7 +25,7 @@ export class Range {
this.end.character,
]
}
public static fromLsif(range: number[]): Range {
public static fromPackedRange(range: number[]): Range {
const endLine = range.length === 3 ? range[0] : range[2]
const endCharacter = range.length === 3 ? range[2] : range[3]
return new Range(
Expand Down
8 changes: 4 additions & 4 deletions src/SnapshotTesting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function formatSnapshot(

if (formatOptions.showRanges && occurrence.enclosingRange.length > 0) {
enclosingRanges.push({
range: Range.fromLsif(occurrence.enclosingRange),
range: Range.fromPackedRange(occurrence.enclosingRange),
symbol: occurrence.symbol,
})
}
Expand Down Expand Up @@ -244,7 +244,7 @@ export function formatSnapshot(
// This is the only case where we would need to do this.
if (occurrenceIndex === 0) {
const occurrence = doc.occurrences[occurrenceIndex]
const range = Range.fromLsif(occurrence.range)
const range = Range.fromPackedRange(occurrence.range)

// This is essentially a "file-based" item.
// This guarantees that this sits above everything else in the file.
Expand Down Expand Up @@ -286,7 +286,7 @@ export function formatSnapshot(
throw new Error('not yet implemented, multi-line ranges')
}

const range = Range.fromLsif(occurrence.range)
const range = Range.fromPackedRange(occurrence.range)

out.push(commentSyntax)
const isStartOfLine = range.start.character === 0
Expand Down Expand Up @@ -336,7 +336,7 @@ export function formatSnapshot(
}

function occurrencesByLine(a: Occurrence, b: Occurrence): number {
return Range.fromLsif(a.range).compare(Range.fromLsif(b.range))
return Range.fromPackedRange(a.range).compare(Range.fromPackedRange(b.range))
}

function enclosingRangesByLine(
Expand Down
2 changes: 1 addition & 1 deletion src/SourceInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function typescriptSourceInfo(sourceFile: ts.SourceFile): SourceInfo {
fileName: sourceFile.fileName,
originalText: sourceFile.getText(),
isSvelte: false,
range: node => Range.fromNode(node).toLsif(),
range: node => Range.fromNode(node).toPackedRange(),
declarationSymbol: () => undefined,
releaseCaches: () => {},
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ for (const snapshotDirectory of snapshotDirectories) {
fs.mkdirSync(outputRoot, { recursive: true })
fs.renameSync(output, path.join(outputRoot, 'index.scip'))
if (index.documents.length === 0) {
throw new Error('empty LSIF index')
throw new Error('empty SCIP index')
}
if (index.documents.some(document => document.language === 'Svelte')) {
assertStableSvelteSymbols(index)
Expand Down
Loading