Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Language Server - proof of concept #366

Merged
merged 47 commits into from
Aug 6, 2018
Merged

Language Server - proof of concept #366

merged 47 commits into from
Aug 6, 2018

Conversation

wingrunr21
Copy link
Collaborator

This is a proof of concept internal language server. The server itself is opt-in and will gradually replace features in the core extension. This means if you don't like the server's features you can turn it off and go back to the current feature set.

This may not look like much but tree-sitter was a bit of a moving target. I also did a ton of research on how to implement some of the other features/problems that are currently in the extension.

Features

  • Parses current document on server into an AST using node-tree-sitter. This is the same experimental syntax highlighter Atom is using. This positions us quite well to support things like semantic syntax highlighting!
  • Balanced pair highlighting - The highlight provider will only send back highlights for balanced pairs. This is inline with the current highlighter (except this one works correctly). Next steps will be expanding the provider to highlight other language constructs (like all occurrences of methods or variables within a document)
  • new feature! Syntactic code folding - I implemented the proposed syntactic folding provider to allow correctly identified region folding. Next steps will be to implement the other two types of supported folds (multiline/block comments and requires).

Merge Blockers

  • Update documentation
  • Figure out best way to distribute node-tree-sitter and tree-sitter-ruby against the version of Electron VSCode is running on

@wingrunr21
Copy link
Collaborator Author

I'm currently poking at the tree-sitter/tree-sitter-ruby problem via prebuild and its supportive tooling. Hopefully that's a quick fix.

@wingrunr21 wingrunr21 mentioned this pull request Jul 4, 2018
6 tasks
@wingrunr21 wingrunr21 mentioned this pull request Jul 17, 2018
@wingrunr21
Copy link
Collaborator Author

Tree sitter related PRs landed this weekend. Once new releases are cut with prebuilt binaries I'll update this branch and prep a release!

@numbcoder
Copy link

Nice job!
Can't wait for this PR!

oldEndPosition: this.computeEndPosition(startIndex, oldEndIndex, tree), // position in old doc change ended.
newEndPosition: Position.FROM_VS_POSITION(range.end).toTSPosition(), // position in new doc change ended
});
tree = this.parser.parse(text, tree);

Choose a reason for hiding this comment

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

I think that you could move this parse call out of the for loop and just parse once with the final text.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ya that’s on my refactor list. I’m planning on building out a more robust object tree on my second pass here. Also need to figure out how to support incremental updates with the API VSCode exposes. I don’t think this is quite right

@wingrunr21
Copy link
Collaborator Author

Planning to merge this and cut a release this weekend

@wingrunr21 wingrunr21 merged commit f38f2b7 into master Aug 6, 2018
@wingrunr21 wingrunr21 deleted the language_server branch August 6, 2018 16:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants