Skip to content

Adopt to new vscode log output channel API #1116

Activity

  1. added this to the milestone on Dec 9, 2022
  2. dbaeumer commented on Dec 13, 2022

    @dbaeumer
    Member
  3. dbaeumer commented on Sep 13, 2023

    @dbaeumer
    Member

    I recalled all the discussion we had and I looked into making this backwards compatible with the settings I introduced. However this is quite some work for no real benefit. So I decided to make this a breaking change to align with VS Code's behavior and ship it in 3.18.

  4. modified the milestones: , on Sep 13, 2023
  5. modified the milestones: , On Deck on Jul 8, 2024
  6. JustinGrote commented on Oct 29, 2024

    @JustinGrote

    Dirk Bäumer (@dbaeumer) following up on this, are there any major issues pending or anything I can contribute (tests, etc.) to move this along? For the PowerShell extension we really would like our LSP server messages to have severity filtering available.

  7. JustinGrote commented on Oct 30, 2024

    @JustinGrote

    Alternatively, have you considered implementing something like the DebugAdapterTrackerFactory in vscode?
    https://vscode-api.js.org/interfaces/vscode.DebugAdapterTrackerFactory.html

    As an author, I find this the most useful as I can control how messages from the client are logged.

  8. dbaeumer commented on Oct 30, 2024

    @dbaeumer
    Member

    You can do that in LSP as well. It provides a middleware were you can intercept each message in a specific or generic way.

  9. JustinGrote commented on Oct 30, 2024

    @JustinGrote

    Dirk Bäumer (@dbaeumer) there's the info/warn/etc. methods on the LanguageClient though, and I'm concerned if I go the middleware route I'll miss any logs that someone may have sent to the languageclient directly using these methods.

  10. 2 remaining items

  11. dbaeumer commented on Mar 19, 2025

    @dbaeumer
    Member

    It will not be a breaking change in terms of API it is more a behavioral breaking change. Currently every extension can control the log via a setting. When I move to the log channel that is not possible anymore. The only way will then be to manage this via the normal VS Code interface.

  12. jasonmalinowski commented on Mar 19, 2025

    @jasonmalinowski
    Member

    Dirk Bäumer (@dbaeumer) In the case of the C# extension we're creating our own output window and recently moved it over to the logging form, so we already took the user experience break in that case. In your old PR you had light-up to detect if it was the new kind of output and only use it then -- if you restricted it to that case of externally-provided output windows does that solve the concern?

  13. dbaeumer commented on Mar 20, 2025

    @dbaeumer
    Member

    I think my problem was not only if clients provide their own channel but also I want to solely use the new log channel. That will break. But this is a long time ago and thinks might have changed. I would need to look at the code again and the current VS Code behavior to make a correct statement around this.

  14. JustinGrote commented on Mar 20, 2025

    @JustinGrote

    What I would see as ideal (and others can chime in):

    As "you" are a library we are consuming and not an end user product, you should not be dictating to "us" how we log output from your library. Instead:

    1. as part of the constructor options, you should provide a optional logger? option with type vscode.LogOutputChannel | boolean | undefined
    2. If I supply a LogOutputChannel, you use that as yours. Now I have complete control over how the logs are handled. I can either give you directly a LogOutputChannel, or I can create my own adapter and format/filter/etc. the logs as I see fit (say I want to reduce certain noise, etc.)
    3. If I supply true, you enable your default implementation and make it easy for me. Both use the same code paths, you're just providing a default LogOutputChannel implementation, either directly via createOutputChannel or your own custom formatting.
    4. If logger is not specified (it's set to undefined), then you fall back to the existing behavior so as not to break people who are currently relying/expecting extension.trace.server style behavior

    Ideally all logging is done as structured logging, but this is a nice-to-have.

  15. jasonmalinowski commented on Mar 24, 2025

    @jasonmalinowski
    Member

    I'm a little confused here since as best I can tell what Justin Grote (@JustinGrote) is asking for is what Dirk Bäumer (@dbaeumer) more or less already implemented in his branch. LanguageClient's constructor takes a LanguageClientOptions, which already takes a vscode.OutputChannel. You can pass a LogOutputChannel there just fine since LogOutputChannel extends OutputChannel. So extensions (like C#) have already moved to the newer output window type without issue.

    The only tricky bit is this line:

    8298ef3#diff-1442f78812d67be25f18d3b5d82e8b4191ae2f939a900eac32d4360222c5d845L608-R613

    where if an outputChannel isn't already provided one is created; this is opting into making a log window. Just remove that log: true and you don't have a breaking change -- languages can opt-in to the new behavior just by passing a new output channel.

  16. dbaeumer commented on May 8, 2025

    @dbaeumer
    Member

    Techatrix (@techatrix) thanks a lot for the PR.

    I tried to recall what my problems where when I worked on it last time and the major problem is the UI / setting experience. Currently the LSP client automatically offers a setting {name}.server.trace which allows to control the tracing behavior. When we switch to the new Log Channel we can't keep that setting since we can't programmatically change the log level of a channel. This can only be done by the UI

    Image

    To avoid any confusion here I actually think that the right way forward would be to break the API and require log channels all together and deprecated the setting. We could add a warning to the channel if a setting value is detected that doesn't match the log channel's severity.

    Breaking the API has also the advantage that the outputChannel and the traceOutputChannel would return LogChannel which will avoid that clients need to do is checks on the returned channel to use it as a log channel.

    Jason Malinowski (@jasonmalinowski) could the C# team live with such a breakage?

  17. dbaeumer commented on May 8, 2025

    @dbaeumer
    Member

    Regarding deprecating the setting. What I would do is to use the setting only to control the trace level. Currently we have off, messages, compact and verbose. off would disappear since it will be controlled via the UI. The rest of the values we would keep.

    An alternative might be to remove compact and map debug => messages and trace => verbose

  18. jasonmalinowski commented on May 8, 2025

    @jasonmalinowski
    Member

    Dirk Bäumer (@dbaeumer) We would already be fine -- we've already transitioned to using a log channel and are no longer using a special option. We have always been passing in the log channel we already created, so for us the concerns about 'upgrading' to the new format was fine since we've already taken the user experience break.

  19. JustinGrote commented on May 8, 2025

    @JustinGrote

    Same here for the PowerShell extension.

  20. dbaeumer commented on May 9, 2025

    @dbaeumer
    Member

    Created a new PR #1630

    Let me know if there are any objections / comments.

  21. dbaeumer commented on May 12, 2025

    @dbaeumer
    Member

    New next releases are out:

    client@10.0.0-next.15
    server@10.0.0-next.13

  22. modified the milestones: On Deck, on May 12, 2025
  23. JustinGrote commented on May 12, 2025

    @JustinGrote
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requestRequest for new features or functionality

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions