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

VSCode Extension Host Integration #1058

Open
bryphe opened this issue Dec 16, 2019 · 39 comments
Open

VSCode Extension Host Integration #1058

bryphe opened this issue Dec 16, 2019 · 39 comments
Assignees
Labels
A-extension Area: Extension/plugin integration, vscode or VimL A-language-support Area: Language support, syntax highlighting, language server etc. meta A big-picture issue, often collecting a number of other issues for discussing overarching solutions U-exthost Upstream: Issue in VSCode extension host

Comments

@bryphe
Copy link
Member

bryphe commented Dec 16, 2019

This is a top-level issue tracking all of the VSCode extension host integration

High-level feature view

Category API Implemented UI Integrated Notes
Activation Events Partial N/A Need to handle additional events (onWorkspace:, etc)
DIscovery (Searching for Extensions) Implemented against https://open-vsx.org
Extension Management
Extension Auto-Update
Extension Deltas No - needed for auto-activation after install
TextMate Grammars
Authentication Not yet implemented
Color Themes No
Console
Commands
Comments Not yet implemented
Debugger Support
Configuration Partial No
Dialogs Partial Partial Not yet implemented
Diagnostics
DocumentContentProvider
Documents
Editor Insert Needs HTML renderer / CEF
Errors
File System Provider N/A N/A
Language Features: Auto-Closing Pairs Partial N/A
Language Features: Auto-Indent Partial N/A
Language Features: Code Actions
Language Features: Codelens
Language Features: Code Inset
Language Features: Color Provider
Language Features: Completion Needs snippet integration
Language Features: Diagnostics
Language Features: Document Symbol
Language Features: Dynamic Language Configuration
Language Features: Find-all References
Language Features: Folding Range
Language Features: Go-to Definition
Language Features: Document Formatting
Language Features: Range Formatting
Language Features: As-you-type formatting
Language Features: Hover
Language Features: Call Hierarchy
Language Features: References Needs to handle resolve positions for UI
Language Features: Renaming
Language Features: Semantic Tokens #3370
Language Features: Signature Help
Language Features: Workspace Symbol
Languages
Notebooks
QuickOpen Partial Partial Choice menu is integrated, but input and validation is not
Remote Extensions
Search
Source Control: Pane Tracking in #1011
Source Control: Diff View
Snippets
Status Bar No
Tasks
Text Editors Partial N/A - Decorations tracked in #3189
Telemetry We don't collect or store telemetry
Terminal Partial No Need to handle $createTerminal for REPL integration
Timeline
Tree Views Tracking in #3126
Tunnel Service
URLs
Virtual File Systems (Plugin Provided) Partial
Webviews Tracked in #3128
Workspace Partial N/A need to handle multi-root and additional APIs (search results)

Tested plugins

Plugin Name Status Notes
Built-in markdown language server
Built-in json language server
Built-in html language server
Built-in css-language-server
Built-in javascript/typescript language server
vscode-auto-close-tag Blocked by #2257
reason-language-server Bundled
Emmet Bundled
Python: ms-python.python Needs to be run with virtualenv activate, in project root
C/C++: clangd OSX only?
C/C++: exuberant-ctags
Elm: elmtooling.elm-ls-vscode
JS / TS: prettier
OCaml / Reason: ocaml-lsp See instructions: https://onivim.github.io/docs/languages/reason-ocaml
muhammad-sammy.csharp
redhat.java
maktlad.rust-analzyer
eamodio.gitlens Blocked by missing language features
golang.Go
vetur Blocked by #1174
vscode-elixir Not tested yet
@bryphe bryphe added the meta A big-picture issue, often collecting a number of other issues for discussing overarching solutions label Dec 16, 2019
@bryphe bryphe self-assigned this Dec 16, 2019
@bryphe bryphe added A-language-support Area: Language support, syntax highlighting, language server etc. U-exthost Upstream: Issue in VSCode extension host labels Dec 16, 2019
@jpinnix
Copy link

jpinnix commented Dec 19, 2019

Thank you so much for this! Super helpful!

@jtsiros
Copy link

jtsiros commented Jan 4, 2020

Great work! I've been excited about the vscode extension host integration.

@yunti
Copy link

yunti commented Jan 6, 2020

Will code folding come in as part of LSP support or eg textmate grammars?

@CrossR
Copy link
Member

CrossR commented Jan 7, 2020

I think we have multiple locations we can take folding from: LSP does implement it, there is some part in the VSCode grammars (language-configuration.json mentions folding) and then also tree-sitter could be used as well (for AST based folding).

@CrossR CrossR mentioned this issue Jan 8, 2020
@glennsl glennsl added the A-extension Area: Extension/plugin integration, vscode or VimL label Jan 10, 2020
@jtsiros
Copy link

jtsiros commented Jan 22, 2020

Does anyone know if vscode-go works with the latest nightly? I have gopls installed along with the following configuration:

gopls version
golang.org/x/tools/gopls 0.2.2
    golang.org/x/tools/[email protected] h1:ujGisyytgY1VGcmd66wIJ9+wVAfmodXj6daHM43HRXk=

Oni config:

"[go]": {
        "editor.snippetSuggestions": "none",
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true
        }
    },
    "gopls": {
        "usePlaceholders": true, // add parameter placeholders when completing a function
        "completeUnimported": true, // autocomplete unimported packages
        "watchFileChanges": true, // watch file changes outside of the editor
        "deepCompletion": true, // enable deep completion
        "hoverKind": "FullDocumentation"
    }

Extensions installed:

oni2 --list-extensions
Go
one-monokai
gitlens
theme-github

Autocomplete doesn't seem to work out of the box for it.

@bryphe
Copy link
Member Author

bryphe commented Jan 23, 2020

Haven't tested it, yet! I've added it to our list in the above issue, though.

Thanks for the details, @jtsiros - likely #1157 is impacting this, but there may be other issues too past that.

@glennsl glennsl pinned this issue Jan 25, 2020
@edisonywh
Copy link

Does VSCode work with the Dart/Flutter LS? There's some heavy lag when using the vim plugin and the Dart extension together on VSCode (due to some autocompleting filtering apparently, tracked here).

Just want to find out if Onivim has that integration!

@Falconerd
Copy link

@edisonywh If you manage to get a flutter + onivim2 setup working please share! That issue with VSCode frustrated me enough to seek alternatives (hence here I am)

@edisonywh
Copy link

@Falconerd unfortunately I did not manage to get it to work, but I decided to try out VSCode Insider and that performs a lot better with Flutter, so I'm using that right now, hope that helps!

@gitbugr
Copy link

gitbugr commented Mar 2, 2020

vscode-intelephense partially works. goto definition works, autocomplete and others don't

@sekunho
Copy link

sekunho commented Apr 27, 2020

For Elixir vscode-elixir isn't maintained anymore. vscode-elixir-ls is the replacement and it's still active.

https://github.com/elixir-lsp/vscode-elixir-ls
https://marketplace.visualstudio.com/items?itemName=JakeBecker.elixir-ls

@andrewrynhard
Copy link

andrewrynhard commented May 2, 2020

Are there any plans to test vscode-go any time soon? Happy to help if I can. I have it installed along with gopls, but nothing seems to happen. Tried enabling trace logging, and I'm not seeing anything of interest.

@dannyfritz
Copy link

Will this cover virtual documents? https://code.visualstudio.com/api/extension-guides/virtual-documents

@steveklabnik
Copy link

I tested the rust-analyzer extension today, and it doesn't work yet. Given the chart above, I wouldn't expect it to, but figured I'd leave a comment anyway, in case anyone else gives it a shot.

@tofulm
Copy link

tofulm commented Jul 31, 2020

I use PHP Intelephense. is it possible to define a "rootPatterns" like coc.nvim

Ok => #729

@jirmonder
Copy link

Tested Emmet on 0.4.0 installed with the new plugin installation support, it installed without trouble, but it wouldn't work on use

@jirmonder
Copy link

Tested Auto Close Tag on 0.4.0 installed with the new plugin installation support, it installed without trouble, but it wouldn't work on use

@bryphe
Copy link
Member Author

bryphe commented Aug 6, 2020

Sorry for the slow reply!

@steveklabnik - cool to see you here. I'm a big fan of your blog and work on Rust! I tested the latest build with rust-analyzer and it seems to be working now:

image

At the time you wrote the comment, the $download API hadn't been implemented. There was also an issue where we weren't the releaseTag correctly: open-vsx/publish-extensions#106 Seems like it's working now (on OSX). I hope I can find occasion to use it, feels really nice!

@tofulm - yep, still need to implement multi-root workspaces 👍

@jirmonder - thanks for testing Emmet and Auto-Close Tag! I opened a PR tracking some of the issues needed to be addressed for Emmet: #2244 (And #1948 is tracking it). Will exercise some additional capabilities we need for completion.

I looked at Auto-Close Tag - and it's actually a bug in Onivim. We're sending buffer updates line-wise in a way that the logic where it checks for the 'closing' tag: https://github.com/formulahendry/vscode-auto-close-tag/blob/f0129c2b1179718dae927082720dd9c7cf127927/src/extension.ts#L104 isn't working as expected. It's been on my list for a while to streamline buffer updates / content changes (for perf) - a bonus will be, the content changes should be in the correct format for that plugin. Opened #2257 to track

bryphe added a commit that referenced this issue Jan 15, 2021
…uest call (#2995)

__Issue:__ The terraform extension was failing with an error:

> Error: Activating 'hashicorp terraform' failed: The "listener" argument must be of type function. Received an instance of Object

__Defect:__ The extension was crashing here:
```
	https.request(url, options, res => {
			if (res.statusCode === 301 || res.statusCode === 302) { // follow redirects
				return resolve(httpsRequest(res.headers.location, options, encoding));
			}
```
when trying to resolve download locations for terraform releases. This was not specific to this plugin, but actually could crash in any 3-param call to `https.request`. (There are two overloads - a `https.request(options, cb)`, and `https.request(url, options.cb)`.

Because of the `agent-base` dependency that is brought in the node environment, it overwrites the `https.request` handler such that only the 2-param overload is accepted. More info here: microsoft/vscode#93167

__Fix:__ Update the `proxyResolver` code to only use the 2-param overload in our node environment, which the extension host is running in - onivim/vscode-exthost#30 . Add some test cases to ensure that both overloads can make requests

With this fix, as the language server now gets installed, get some basic language features (diagnostics, some completion, and outline) for terraform files:
![image](https://user-images.githubusercontent.com/13532591/104756239-6b867800-5710-11eb-8aff-cfd082ce0f1b.png)

Fixes #2981 
Related #1058 

Note that there is still a pending issue relating to the syntax highlights for terraform: #2220
bryphe added a commit that referenced this issue Jan 16, 2021
__Issue:__ Diagnostics weren't displaying in the elm extension

__Defect:__ Diagnostics are computed on save, but we weren't sending the appropriate event to the extension host to let it know when a save occurred.

__Fix:__ Notify extension host on save

With that, we get diagnostics:
![image](https://user-images.githubusercontent.com/13532591/104788805-02225b80-5748-11eb-819b-2f5dc06b2b6d.png)

Fixes #2640 
Related #1058
bryphe added a commit that referenced this issue Jan 19, 2021
…on dependency (#3007)

__Issue:__ When an extension has a required dependency that is not installed, Onivim would fail to activate the extension silently.

__Defect:__ Onivim was not properly handling the extension activation error - usually, it's a `string`, but in the case of a missing dependency, it is a JSON object - the parser was only handling the string case.

__Fix:__ Implement a decoder to handle either case. Bubble up the activation error to the user.

Related #2676 
Related #1058
bryphe added a commit that referenced this issue Jan 20, 2021
…cache (#3016)

__Issue:__ There is a memory leak in our completion items, signature help, and codelens via the extension host - may be responsible for the `SIGABRT` described in #3009 (as this can occur when the JS heap is out of memory).

__Defect:__ The extension host adds a layer on top of the language server protocol, to serve as a cache for several language features - this helps performance when resolving items. However, this caching layer relies on the client to notify it when the items are no longer in use, so they can be cleaned up. Onivim was missing this `release` step.

__Fix:__ Bake in the call to `release` in all the relevant subscriptions. This involves picking up the `cacheId` which wasn't wired up in some places (like codelens), setting up the `release*` API, and passing it back on conclusion of the subscription.


To test this fix - I flipped the `Cache.enableDebugLogging` flag in the extension host and initiated several completions. Before this fix, it's obvious the caches were simply growing endlessly:
```
CompletionItem cache size — 1
CompletionItem cache size — 1
CompletionItem cache size — 2
CompletionItem cache size — 2
SignatureHelp cache size — 1
CompletionItem cache size — 3
CompletionItem cache size — 3
CompletionItem cache size — 4
CompletionItem cache size — 4
SignatureHelp cache size — 2
...
CompletionItem cache size — 15
CompletionItem cache size — 15
CompletionItem cache size — 16
CompletionItem cache size — 16
CompletionItem cache size — 17
CompletionItem cache size — 17
SignatureHelp cache size — 8
CompletionItem cache size — 18
CompletionItem cache size — 18
CompletionItem cache size — 19
CompletionItem cache size — 19
```

After this fix, though, we can observe that the cache gets cleaned:
```
CompletionItem cache size — 1
CompletionItem cache size — 1
CompletionItem cache size — 0
CompletionItem cache size — 0
CompletionItem cache size — 1
CompletionItem cache size — 1
CompletionItem cache size — 0
CompletionItem cache size — 0
SignatureHelp cache size — 1
SignatureHelp cache size — 0

...
CompletionItem cache size — 0
CompletionItem cache size — 0
SignatureHelp cache size — 1
SignatureHelp cache size — 0
```

Related #3009 
Related #1058
bryphe added a commit that referenced this issue Jan 20, 2021
#3019)

__Issue:__ The Ionide.Ionide-fsharp extension depends on `ms-dotnettools.csharp`, which isn't available on open-vsx

__Fix:__ The best-case fix would be to have the ionide-fsharp extension published to open-vsx and have proper dependencies. In the meantime, add a temporary override to map `ms-dotnettols.csharp` -> `muhammad-sammy.csharp` to unblock the extension.

With this change - basic language features work:
![2021-01-14 16 37 31](https://user-images.githubusercontent.com/13532591/104665774-13effa00-5687-11eb-84f0-054bc8129c6f.gif)

Fixes #2974 
Related #1058
bryphe added a commit that referenced this issue Jan 27, 2021
__Issue:__ The [`https://open-vsx.org/extension/nimsaem/nimvscode`](https://open-vsx.org/extension/nimsaem/nimvscode) extension was failing to activate

__Defect:__ The extension was logging out `ctx.storagePath`, which was undefined, because workspace storage was not implemented

__Fix:__ Implement workspace storage - add `.config/oni2/workspace` 

With workspace storage implemented, I get language features via the `nimsaem/nimvscode` extension:

![image](https://user-images.githubusercontent.com/13532591/105923636-83ec7180-5ff1-11eb-9c92-0c30e7e1b1e9.png)

Related #1058 
Related #2676 

__TODO:__
- [x] Check default / no workspace case 
- [x] Add test to verify `ctx.storagePath` is populated now
@mabasic
Copy link

mabasic commented Jan 29, 2021

I have installed File Utils by sleistner, but when I go File Utils: Duplicate it does not show the prompt as VS Code does, so I cannot use it. Should I open a issue for this or ?

@jaidetree
Copy link

Not sure if this is the place to mention it or not. Would love to be able to use the Calva extension, if not all of its capabilities at least some of them. - https://open-vsx.org/extension/betterthantomorrow/calva

+1 for me, onivim is lookin' real slick so far. If it can support mature Clojure tooling out-of-the-box from the VS Code community then that would be a major win for me.

@nerdo
Copy link

nerdo commented Feb 24, 2021

The more mature onivim gets, the more excited I get. I've been using the vscode neovim plugin for a while and continue to get frustrated by its bugginess and resort to opening (neo)vim directly to make some changes to files more efficiently without the vscode integration getting in my way.

One vscode extension that I'm hoping 🤞🏾 will work with onivim is wallaby.js. It's become an indispensable to my test driven workflow whenever I work with JS/TS applications.

Last time I tried it, it loaded, but didn't actually work, probably because it relies on some features not yet implemented by the extension host... but I hoping it will work when all is said and done 😅

@bryphe
Copy link
Member Author

bryphe commented Feb 26, 2021

Thanks @nerdo ! Was just checking this out - it is a really cool extension - real-time test feedback is amazing.

I saw you already logged an issue on the wallaby repo: wallabyjs/public#2436 - appreciate it!

In terms of Onivim support - it looks like it uses a few APIs that we don't support yet:

@likern
Copy link

likern commented Mar 14, 2021

Tried to use onivim as a main editor for React Native development (Javascript / Typescript). At first glance looks very promising, very like it.

But quickly I've found the main major blocker for me. In modern JS we export / reexport symbols from modules like this

// test.ts file
export const test = () => {};
// index.ts
export { test } from './test'
// other.ts
import { test } from './test'

So renaming test requires to rename it in all other files where symbol was imported / re-exported.
I can live without many features, but this one is just a workflow breaking.

@bryphe
Copy link
Member Author

bryphe commented Mar 15, 2021

Tried to use onivim as a main editor for React Native development (Javascript / Typescript). At first glance looks very promising, very like it.

Awesome @likern !

So renaming test requires to rename it in all other files where symbol was imported / re-exported.
I can live without many features, but this one is just a workflow breaking.

I'm actually looking at working on the rename functionality for the next milestone - going to be starting work on it next week. So it'll be great to have your feedback.

I plan on exposing two bits of functionality - a 'local rename' - that allows renaming all the identifiers in a file. More interesting for the use case you called out, though, is a workspace rename, which renames all the identifiers across a project.

@likern
Copy link

likern commented Mar 16, 2021

@bryphe Do you mean feedback when renaming will be landed in nightly builds?

Or are we talking about envision of how this should work (haven't thought about it much)?

Either way I'll be happy to test this out 🤗

If we are talking about local renames I think there should be some integration with workspace renaming. So not to be in a situation where local renames silently break code (as would in my examples).

Also I think there should be a better way then what VS Code does - as far as I remember it just opens all modified files with draft / unsaved state. But we don't have fine-grained control over this process.

Ideally there should be a way to iterate over changes and to apply / deny on per change basis (something similar to outline concept, where on click I see symbol in context in file). This is especially helpful for big renames.

Also VS Code (or Typescript Language Service?) previously changed how renaming in JavaScript / Typescript works. Previously they directly renamed symbol.

Now they do not rename, but add import Symbol as NewSymbol, or the other way around in imports (don't remember specific details).

That's the most annoying thing ever. 99% of the times I want direct / real renaming for all parts. I have to go to every file and fix it manually.

@n0bra1n3r
Copy link

Thank you so much for this project! I was wondering if you could add the Nim language plugin (nimsaem.nimvscode) to this list. I get this error with it installed:
image
I'm not sure why the other language plugins in the list work while this one doesn't. How can I help with this?

@gjroelofs
Copy link

I think we have multiple locations we can take folding from: LSP does implement it, there is some part in the VSCode grammars (language-configuration.json mentions folding) and then also tree-sitter could be used as well (for AST based folding).

Will folding at the view level be implemented in VSCode style (line-based) or character/token based (preferred)?

@morganhein
Copy link

I'm actually looking at working on the rename functionality for the next milestone - going to be starting work on it next week. So it'll be great to have your feedback.

I plan on exposing two bits of functionality - a 'local rename' - that allows renaming all the identifiers in a file. More interesting for the use case you called out, though, is a workspace rename, which renames all the identifiers across a project.

This is the only thing keeping me from using Onivim2. "This" being both local rename and workspace rename. I'm not sure these kinds of comments are helpful, but just in case they help direct where you put your attention, here you are.

I would love to test-drive this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-extension Area: Extension/plugin integration, vscode or VimL A-language-support Area: Language support, syntax highlighting, language server etc. meta A big-picture issue, often collecting a number of other issues for discussing overarching solutions U-exthost Upstream: Issue in VSCode extension host
Projects
None yet
Development

No branches or pull requests