Giter Club home page Giter Club logo

Comments (5)

rchl avatar rchl commented on July 22, 2024

I have never been bothered by the current behavior and probably would even miss this behavior if it wouldn't happen.

That said I don't run Julia :)

If you think that it would be useful then probably there are other people that would think so too. Besides the fact that it's not doable right now, how would you see this implemented? As a global or per-server option? Do you think the current behavior should be the default?

from lsp.

jwortmann avatar jwortmann commented on July 22, 2024

Besides the fact that it's not doable right now, how would you see this implemented? As a global or per-server option? Do you think the current behavior should be the default?

I wouldn't even make it configurable. In my opinion it should be the only possible and expected behavior to not start the server for semi-transient views. Regarding implementation, just add and not v.sheet().is_semi_transient() to the condition of

LSP/plugin/documents.py

Lines 63 to 66 in 75bd043

def is_regular_view(v: sublime.View) -> bool:
# Not from the quick panel (CTRL+P), and not a special view like a console, output panel or find-in-files panels.
is_widget = v.settings().get('is_widget')
return not v.sheet().is_transient() and v.element() is None and not is_widget

and then use a potential new API method on_promote_sheet of EventListener to attach the language server (like currently in on_activated_async).

I'm a bit surprised that you like/prefer the current behavior, and I wonder if you would then prefer to attach the server to transient views too, like when scrolling through the Goto Anything quick panel? I mean they are both used as a file preview, and the only difference is that semi-transient sheets have a tab, while fully transient don't.

from lsp.

rchl avatar rchl commented on July 22, 2024

I wouldn't want/need to start server on previewing from Goto panel since its not at this point clear whether I want to even look at a given file.

But with semi-transient view, if it's my project then I'm pretty sure I've opened files like that before to check if there are any issues in the file after making other changes. Hard to say for sure as it's an automatic process and I don't think when I do that.

from lsp.

jwortmann avatar jwortmann commented on July 22, 2024

I had an idea for a compromise (in theory); if there is already a session running in the window, then the semi-transient sheets would get attached to this session. But if there is no applicable session, opening a semi-transient sheet won't initiate the start of a language server. This way diagnostics would still be visible when clicking through preview sheets after making other changes (assuming that you have some other file still open), but it can prevent an accidental start of a server for unrelated files.

Unfortunately still not possible to implement at the momemt, without having some kind of event triggered when a sheet gets promoted from semi-transient.


Not directly related, but I also wonder whether we could render diagnostics even for transient sheets. Because right now, when you use the "Goto Diagnostic in Project" panel, then the diagnostics are shown in the quick panel, but not in the file itself while being a preview, unless the file was already open. But I'm not sure how much refactoring would be needed to make the diagnostics available even when the view is not attached to the language server (I think at the moment rendering is bound to SessionView).

diagnostics.webm

from lsp.

rchl avatar rchl commented on July 22, 2024

Not directly related, but I also wonder whether we could render diagnostics even for transient sheets. Because right now, when you use the "Goto Diagnostic in Project" panel, then the diagnostics are shown in the quick panel, but not in the file itself while being a preview, unless the file was already open.

I think that would make sense. But it shouldn't apply just to transient files but to any files because server can technically also report diagnostics for files it doesn't support itself. For example typescript server can report diagnostics for its configuration file tsconfig.json.

from lsp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.