Is there a way to point to the current file (by location) with its LanguageServer running, such that, you can:
- run some arbitrary function
doSomething - and use that pointer within such a function when trying to create a lens in VSCode?
Is there a way to point to the current file (by location) with its LanguageServer running, such that, you can:
doSomething
The way to pass in parameters to the handler of a lense is to first extend the
Commandlanguage with a new command, like so:Next the lense detector collects all the lenses for a file, and binds all the parameters. This is an example that uses / to collect locations of expressions:
Finally the command handler executes the command when triggered:
Then you register the lenses and the handler function as a contribution.
Small parse trees or abstract subtract trees can be parameters to commands directly so you won't have to reparse, however if you have many large editors open it's better to pass locations and parse again for the sake of memory leaks.