-
Notifications
You must be signed in to change notification settings - Fork 874
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
Opt-in to use ErrorProviderBridge #7659
Conversation
With this change the PHP support seems to display non-duplicated warnings and the Enso support continues to work (after overriding the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the update. However, I don't think this is the right approach.
Introducing an API in the stabilization branch feels wrong. For the implementation od isEnabled
: GraphicsEnvironment.isHeadless()
is IMHO a bad base to decide whether or not to enable it. I can imagine a GUI tool, that is run headful, but wants to provide an LSP. It is totally intransparent, why it works based on some random system property.
From my POV the problem comes from globally hooking into the lsp.client infrastructure for all files. For normal LSP based implementations (for example typescript) the client works because it is opt-in and won't interfere, when not used.
I understand, that you want to be able to expose the enso functionality quickly, but that can be done without this global approach:
- Shortterm (now):
- revert the changes to
lsp.client
- add
CompletionProvider
and implement aHint
provider in Enso module itself (or in a bridge-module). These two implementation register only functionality for their target language. You can copy your code and also reuse NetBeans code by copying it (just requires NOTICE file changes if enso is distributed as a plugin without NB)
- revert the changes to
- Longterm (next cycle or later):
- Check if the completion provider and hint provider implemented for enso could be generalized
- If they can be generalized (for example in the
api.lsp
module), add the implementations to the module - Update the enso module to make use of the common implementations and drop the code duplication
It would allow you to continue the work on the enso intregration and still push forward with better integration. For the NetBeans IDE it would allow a safe release and an unhasted realization.
The problem with
I'd like to know what others think then. I can try to implement various solutions, but the core problem remains the same:
That's a misunderstanding. If I wanted to expose Enso functionality in NetBeans, I would do what you suggest. But I am (a NetBeans) architect. I don't want people (not me!) to write the same code twice. I want them to provide a single SPI implementation that works in both NetBeans IDE and VSCode. As #7579 demonstrated the
People can usually imagine a lot of weird usecases (I used to be good at that when I was the architect). However for our purposes, we have just three:
The I can also just fix the |
Core point: it does not matter, that #7579 was already merged. It was broken, it can be reverted, it is in the same release cycle. So its existence is not an argument. What annoys me is, that you want to improve enso integration, that is great, but you are risking the NetBeans IDE. I had bad feeling when I saw, that you attached LSP functions to all documents, apart from explicitly lsp.client handled ones. It turned out, that the reason I pulled my veto (that only the Java ErrorProvider has the problem of crosstalk) was wrong. The GsfErrorProvider from my POV demonstrates, that you can implement a targetted bridge, that only affects a subset of mimetypes and thus is safe. What I'm suggesting is to implement the inversion of the GsfErrorProvider, that you can opt in as a module author to use, for example by registering some common bridge implementation. The bridge does not need to be in NetBeans from the beginning as you can implement it in enso without a problem. I see nothing solved by forcing this into NetBeans now. |
This PR does exactly that. As a module author one can opt-in to enable
To allow one to opt-in, one has to create a new API! Options:
|
So, thinking of this: the In other words - there should be an opt-in, based on mime-types. When one creates a support for new language, say L (e.g. mime-type This could either be hardcoded in every implementation class in All in all, I hope Enso and others wanting to reuse their implementation could do something like:
or:
and all could be handled for them, without the need to do magic stuff in |
@jtulach I am sure you know but this is a good time to point out that NetBeans does not have a QA team right now. Variants of this patch were reverted twice before if I remember correctly. I did also try to highlight (#7579 (comment), #7579 (comment), ..) the problem of 1) changes here have proven repeatedly to affect seemingly unrelated areas of NB and 2) there seem to be no regression tests for any of this. All taken together: this is a very bad combination of things! So no, we can't go on like this and merge PRs to stabilize them in master (or delivery, which is worse). RC3 is soon to happen and this wouldn't be a good time to try to patch things up under those circumstances. If you author a PR as PMC/committer and your instincts tell you that this change is risky, you absolutely should make sure to test it well before trying to get it in. I am sorry to say this but I would advise a revert again #7650 since this is is the lowest risk action which brings us back to a state with empirical evidence that it worked fine before. I don't believe in vetos in a project with so many cooks, so I hope we can figure out the right thing to do without invoking them. |
Thanks for sharing your opinions. Yes, what has happened is embarrassing. I sincerely believe it is because inherent backward incompatibility introduced by my changes. I have underestimated the impact of duplicated hints being visible. To fix that I am convinced opt-in is the right solution. Today I got a new idea for opt-in API & implementation. I'll expose it in this PR. @lahodaj - thanks for a deep description of your preferred solution. However, I don't understand it fully and I am pretty sure, it is too late to try it for NetBeans 23 anyway. @mbien - yes, revert might be the most conservative way forward for NetBeans 23. However as stated here, it shouldn't be full revert, but only a revert of |
39ad9ed
to
dc5d4e0
Compare
The new opt-in API is available in dc5d4e0 - unlike the previous |
It's up to @matthiasblaesing whether to modify or withdraw the revert PR - a revert PR is effectively a veto. I'm concerned about tinkering with this for what should be the last release candidate for 23. If I was involved in releases currently I might be inclined to insist on the revert. @ebarboni should have a chance to comment and engage in the decision here too. It's potentially his workload this will impact most if any issues remain. |
According to this comment it is not a veto, but a safety net. At least that was the state four days ago. |
We currently have a single-purpose hack to disable duplicate code completions: netbeans/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/LspCompletionProviderImpl.java Line 61 in 14d5cbc
(which may seemingly be OK, but what happens when someone will register some special-purpose code completion for Enso - will that disable the lsp.client based code completion) And here proposal for another single-purpose hack (which, moreover, will be hard to understand to the users/clients, I think). Will we need more single-purpose hacks for other features? I am sorry, but I fail to see how this is better than having a single clear API (e.g. in a form of an annotation) saying "for mime-type , please use (Maybe, if needed, we could enhance that to support exclusions - like use these |
There's no reason it can't be both. Someone opening a revert PR is effectively saying they would have -1'd and requested changes had the technical concerns been known in advance of merging. That's how we've managed revert PRs in the past. The person who opens them gets to decide whether their concerns have been adequately addressed, as may anyone else who's in favour of the revert. |
@@ -1,5 +1,5 @@ | |||
Manifest-Version: 1.0 | |||
OpenIDE-Module: org.netbeans.api.lsp/1 | |||
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/lsp/Bundle.properties | |||
OpenIDE-Module-Specification-Version: 1.28 | |||
OpenIDE-Module-Specification-Version: 1.29 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't really do spec version increments on delivery at the moment. If this gets merged to delivery it should still use 1.28
I had another look today, and still think we should revert and reevaluate after release.
|
i too am +1 for revert for NB23, reasons given at #7659 (comment) |
FWIW, this shows the high-level API I have in mind: I am not completely happy about the lower-level API (i.e. the mark in the layer/system FS) and internals, but the high-level API (i.e. |
There is a little support for doing an API change of this kind just before RC3. Closing. As wrote here:
As such we should revert only 557c823 commit. |
@lahodaj I think there's something in there worth pursuing. But I'm concerned about anything that makes As this is now closed, something for discussion elsewhere? |
@lahodaj @neilcsmith-net the idea looks sane to me. I share concerns about dependencies aswell though. But this might work:
So users of the module, that provides the @jtulach given the discussion here and in the mindset of being open for alternative implementation I would prefer to revert completely and restart with a clean approach. |
First, I was thinking of putting this new stuff into a separate module, and that may happen, but I always thought it would depend on Not quite sure what's the issue with including Maybe the idea is that this opt-in to use Overall, I don't think |
NetBeans is a platform of libraries as well as the IDE. We publish these all to Maven for a reason. I personally am using I'm not sure what is really LSP specific in this anyway? Except in where it's currently needed obviously! Am I right in thinking this is registering a universal service that basically disables itself per mime type based on the existence of mime-specific providers (previous) or a flag (in your suggestion)? |
Aha, now I understand, this is about: that was supposed to be an example how the API/annotation is used. I could have used any language, but everything was setup for Java, so I used Java. I do not think we would want to use this for Java in production, that's the reason why the commit is separate and on a separate branch. In other words, the (end-user API) proposal is this and only this: the other commit (lahodaj@ec1e7ee) is a way to see how it would be used, and permits experimentation, and would not be used in production. But if we ever wanted to use the Sorry for the confusion. |
Thanks! Yes, I thought it was a curious choice of example but makes sense. Sorry, the previous debugger addition may have made me overly twitchy! 😄 As long as every module that needs to utilise the registration annotation would already be expected to have that dependency (possibly transitively) then I have no problem with it. I'm still wondering on the specific API vs feature of (Mime)Lookup though? |
Fixes #7647 by designing an opt-in API for providers of
ErrorProvider
implementations to enable bridging of their errors into NetBeans IDE as hints.The existing
ErrorProvider
subclasses (that don't override this new method) will only be used in the VSCode extension.New providers are encouraged (by the Javadoc) to override the
hintsLayerNameFor
method to return non-null
value. E.g. to opt-in into the delegation as provided byThis opt-in gives us so much needed compatibility for previously written modules and also easy path for new implementations of
ErrorProvider
to be used in NetBeans IDE.