-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
This command takes language name and a list of files and produces a SCIP file containing both global symbols (from scip-ctags) and locals (if they're available)
predicates crate requires at least 1.69
bbe0a3d
to
89cedbc
Compare
@@ -31,7 +31,7 @@ pub fn get_globals( | |||
Some(globals::parse_tree(config, &tree, source_bytes)) | |||
} | |||
|
|||
pub fn get_locals(parser: BundledParser, source_bytes: &[u8]) -> Option<Result<Vec<Occurrence>>> { | |||
pub fn get_locals(parser: &BundledParser, source_bytes: &[u8]) -> Option<Result<Vec<Occurrence>>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done for consistency with how get_globals and get_symbols receive bundled parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Not a big deal either ways, just a stylistic point) It seems a bit unnecessary to pass a simple enum by reference. The #[derive(...)]
should instead also have Copy
and this value should be passed by value like an integer.
Unrelated to this PR, but have this type be called BundledParser
seems at least a little weird, because it doesn't have any direct parsing related APIs, such as a fn parse(&mut self, s: String) -> Result<Tree, Error>
. Thoughts on renaming this to LanguageName
? (Not asking you to do this; just asking for thoughts on the idea.)
This needs further changes to make the tests run through Bazel, I'm working on it. Shouldn't change the core PR much. |
docker-images/syntax-highlighter/crates/scip-treesitter-cli/Cargo.toml
Outdated
Show resolved
Hide resolved
docker-images/syntax-highlighter/crates/scip-treesitter-cli/src/main.rs
Outdated
Show resolved
Hide resolved
docker-images/syntax-highlighter/crates/scip-treesitter-cli/src/main.rs
Outdated
Show resolved
Hide resolved
docker-images/syntax-highlighter/crates/scip-treesitter-cli/Cargo.toml
Outdated
Show resolved
Hide resolved
docker-images/syntax-highlighter/crates/scip-treesitter-cli/src/main.rs
Outdated
Show resolved
Hide resolved
terms | ||
// ^^^^^ definition scip-ctags globals#ClassInAClass#Enum#terms. | ||
// ^^^^^ definition local 14 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should've been obvious but we never run snapshots on both globals and locals :D
Something to fix/figure out later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made a note of this in https://github.com/sourcegraph/sourcegraph/issues/57791
docker-images/syntax-highlighter/crates/scip-treesitter-cli/src/main.rs
Outdated
Show resolved
Hide resolved
docker-images/syntax-highlighter/crates/scip-treesitter-cli/src/main.rs
Outdated
Show resolved
Hide resolved
docker-images/syntax-highlighter/crates/scip-treesitter-cli/src/main.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! 🚋
A simple CLI that uses our existing Tree-sitter indexing infrastructure, but produces a SCIP file that can be used for uploads.
This PR sets up the build + adds the
index
subcommand itself.The next PR will add:
scip-evaluate
command to heuristically evaluate a SCIP index against another one--evaluate <file.scip>
flag toindex
command to immediately evaluate produced index against another oneTest plan