-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
exclusive flag does not apply to diagnostics #104180
Comments
Yeah, that's the design of diagnostics which use a push model, not a pull model. |
It seems like you want to completely disable the TS extension. Is that right? What's on your agenda there might be an easier way |
Yes, that's right. And I'm certainly interested in exploring other ideas, as the For the guest in a Live Share session, it's almost never valid for local language servers to provide language services, as they don't have enough context for most things, and most of the requests are forwarded to the host machine, so local language services often cause duplicates (one local, one remote). Today, we use the So I think another idea worth exploring is having a property on schemes that require language servers explicitly support that scheme to be activated for it. |
Unsure how that should help with diagnostics and other pushed things like notifications etc. Should this knowledge be shared with extensions so that they ignore said documents? I think that would be a big ask from authors and also a late adoption. Temporarily disabling extensions is IMO the best solution because it addresses these problems
My knowledge about LS might be outdated but isn't it that the guest's extension host (usually) restarts when joining a session? I think that would be a good opportunity to tell the extension host to temporarily disable extensions that the host already has. |
If the language server is never activated, it'll never start pushing notifications. This is similar to your proposal for disabling the extension, except it feels more general. The extension disabling approach will require that Live Share keep a list of extensions that should be disabled on the guest (it's not always the case that the presence of an extension on the host signals it should be disabled on the guest). It's also the case that sometimes we don't do a reload when joining, so extensions that require a reload to be disabled would break this strategy.
Agreed any acceptable solution won't require that other extensions require code changes. I understand that since diagnostics are push instead of pull, VS Code can't prevent language servers from pushing them. But can't it ignore the ones that get pushed when it sees they're for a scheme that the language server doesn't claim to explicitly support? |
Sure - but I wouldn't call that an ideal solution but yet another workaround. Why spend cycles to compute diagnostic if the get discarded anyways. That's why I favouring a "don't even start with this" approach.
Not sure that I understand what general in this context means. General to language servers but not to arbitrary extensions?
CSS, SASS, and JSON are in this camp ever since and I wonder how that is working in LS? How are duplicated diagnostics prevented with those languages? |
Ah, yes, that's a good point.
I meant that we wouldn't need to maintain a list of what extensions to disable for the Live Share guest.
I believe there are some languages which explicitly disable themselves when they detect the So your current recommendation is to maintain a list of extensions that should be disabled for the Live Share guest and write this to the Live Share guest workspace settings when joining a session? Do you have any ideas for how we could automatically detect which extensions to disable? As I noted in an earlier comment, it's not simply the list of those that also exist on the host. But maybe there's some similar check to this that's more accurate.. The other issue with disabling extensions is that there will be some class of extensions that provide language services in addition to other behavior, and we wouldn't want to disable the entire extension, just the language services. E.g. the LaTeX Workshop extension is a hover provider, and we'd want to disable that piece, but not its other functionality. |
Let's reopen the discussion, as this has grown into a general issue, the original design is no longer enough to support the current behavior of multiple extensions. |
@jrieken any suggestions for short-term fixes? After the most recent VS Code release, we have the issue mentioned above where the TS server is running for the Live Share guest and reporting errors that aren't actually errors, and our users were much quicker to notice this than I anticipated. We certainly need to revisit the I thought your suggestion of disabling the TypeScript extension for the guest would be a quick fix, but it doesn't actually appear like that's possible - VS Code offers no APIs for extensions or settings files for disabling other extensions as far as I can tell. Is there anything we can do short of shipping a VS Code update that includes modifications to the behavior of the |
The |
AFAICT, and I wasn't able to track it down to a code change, TS used to not activate for the So no ideas for how we can prevent the local TS extension from providing diagnostics for the Live Share guest with the current version of VS Code? |
In 1.47, the JS/TS extension would only activate on files that use the In order to support the serverless cases, I removed this restriction 4 weeks again in e41c195. This means that JS/TS intellisense now activies for every js/ts file however all cross file operations are still gated to I tested live share to make sure this didn't break IntelliSense must have missed the odd behavior with diagnostics. We do want diagnostics in the serverless case so my proposal is add a special path that disables JS/TS diagnostics on |
Thanks Matt! That seems like a good short-term fix. FWIW, I think that was a reasonable change to make, and it's odd having to special-case the |
I just pushed a scoped fix that should disable all language features and diagnostics for files with the I was having trouble getting live share working in the OSS build, so once the next insiders comes out let me know if this did not fix the issue |
Closing this as a workaround is in place. The design and usage of exclusive should be revisited on a large scope because it has limitations in all areas, not just diagnostics |
An LSP server that registers itself with a document selector that uses the (proposed API)
exclusive
flagwill disable all other language services for requests, such as hover. However, other language services can still provide diagnostics, and presumably other notifications.
I'm attaching a simple extension that repros the issue. Upon running the "hello world" command it registers an LSP server that takes exclusive control over the file scheme for the typescript language. So if you open a TypeScript file, you'll initially get language services powered by the TS Server. Once you run the command, you no longer will get TypeScript language services for hovers, for example. However, the TS Server is still providing diagnostics.
exclusiveSample.zip
The text was updated successfully, but these errors were encountered: