Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

SCIP Tree-sitter CLI #57664

Merged
merged 37 commits into from
Oct 25, 2023
Merged

SCIP Tree-sitter CLI #57664

merged 37 commits into from
Oct 25, 2023

Conversation

keynmol
Copy link
Contributor

@keynmol keynmol commented Oct 17, 2023

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 to index command to immediately evaluate produced index against another one

Test plan

  • Basic end to end test for launching the CLI

@cla-bot cla-bot bot added the cla-signed label Oct 17, 2023
@keynmol keynmol changed the title Scip syntax cli SCIP TreeSitter CLI Oct 17, 2023
@keynmol keynmol marked this pull request as ready for review October 24, 2023 08:59
@@ -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>>> {
Copy link
Contributor Author

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.

Copy link
Contributor

@varungandhi-src varungandhi-src Oct 24, 2023

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.)

@keynmol
Copy link
Contributor Author

keynmol commented Oct 24, 2023

This needs further changes to make the tests run through Bazel, I'm working on it. Shouldn't change the core PR much.

Comment on lines +68 to +70
terms
// ^^^^^ definition scip-ctags globals#ClassInAClass#Enum#terms.
// ^^^^^ definition local 14
Copy link
Contributor Author

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.

Copy link
Contributor

@varungandhi-src varungandhi-src Oct 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@varungandhi-src varungandhi-src left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! 🚋

@keynmol keynmol merged commit f1e7842 into main Oct 25, 2023
@keynmol keynmol deleted the scip-syntax-cli branch October 25, 2023 12:42
@varungandhi-src varungandhi-src changed the title SCIP TreeSitter CLI SCIP Tree-sitter CLI Nov 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants