Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Support editor features for nested languages #1973

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

baronfel
Copy link
Contributor

@baronfel baronfel commented Dec 31, 2023

Closes #1912

This branch relies on using a locally-built version of FSAC from ionide/FsAutoComplete#1159 to actually get the information about nested languages in a document.

The approach taken here is to

  • listen to notifications from FSAC about nested languages in a document
  • use these notifications to create virtual documents for each instance of a detected nested language whose contents are whitespace except for the content of the detected nested language
  • register a TextDocumentProvider for these virtual documents with an Ionide-managed scheme
  • insert a middleware into the LanguageClient that wraps each specific kind of functionality we want to 'light up' for these embedded documents. each wrapped function follows a similar strategy:
    • determine if the action is applicable to any virtual document(s)
    • if so, ask the editor to perform the associated action on the virtual document
    • if not, allow the editor to continue on asking FSAC to handle the interaction

So far, the majority of this seems to work, at least in theory. I am creating and updating the virtual documents on each typecheck of a file, and the middleware functions I've defined are being invoked. However the end-to-end isn't quite working. I'm trying to get Hover working because it's the easiest to see working, but ideally we'd be able to get Hover, Completion, and Highlighting working before merging this.

cc @alfonsogarciacaro for heads-up - I think if we get this right then https://github.com/alfonsogarciacaro/vscode-template-fsharp-highlight could be deprecated, as long as library authors update their libraries to add [<StringSyntax("css")>] or whatever language is appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for nested/tagged languages
1 participant