Skip to content

r.lsp.diagnostics setting does not work #1196

Closed
REditorSupport/languageserver
#577

Description

@qizhengyang2017

I turned off the r.lsp.diagnostics, but the warnings didn't disappear.

Screenshots
image

image

Environment

  • OS: macOS
  • VSCode Version: 1.71.0 (Universal)
  • R Version: 4.0.5
  • vscode-R version: 2.5.3

Activity

  1. ManuelHentschel commented on Sep 13, 2022

    @ManuelHentschel
    Member

    I have the same issue, see also #1191 (comment) ff.

    As a workaround you can disable diagnostics by putting options(languageserver.diagnostics = FALSE) in your .Rprofile.

  2. renkun-ken commented on Sep 13, 2022

    @renkun-ken
    Member

    Cannot reproduce it on macOS and Linux. Maybe it is a Windows-specific issue regarding vscode-languageclient v8.0.2?

  3. ManuelHentschel commented on Sep 13, 2022

    @ManuelHentschel
    Member

    Cannot reproduce it on macOS and Linux. Maybe it is a Windows-specific issue regarding vscode-languageclient v8.0.2?

    That seems to be correct, downgrading to vscode-R v2.5.2 solves the issue for me.

  4. qizhengyang2017 commented on Sep 13, 2022

    @qizhengyang2017
    Author

    How could I downgrade it? I clinck Install another version.., but no reaction. By the way, I used macOS and Linux, so it's probably not a Windows-specific issue.
    image

  5. qizhengyang2017 commented on Sep 13, 2022

    @qizhengyang2017
    Author

    Sorry, I see the pup-up box.

  6. renkun-ken commented on Sep 13, 2022

    @renkun-ken
    Member

    @ManuelHentschel @qizhengyang2017 Would you like to install the latest development version of languageserver, enable r.lsp.debug in vscode settings and take a look at the log of "R Language Server" channel in vscode output pane?

    On languageserver startup, it should receive settings from vscode-R language client like the following:

    [2022-09-13 15:03:14.759] settings  {
      "enabled": true,
      "args": [],
      "promptToInstall": true,
      "debug": true,
      "diagnostics": true,
      "lang": "",
      "use_stdio": false
    }
    

    If you disable r.lsp.diagnostics, languageserver should also receive a notification of changed configuration in the same format:

    [2022-09-13 15:05:21.493] settings  {
      "enabled": true,
      "args": [],
      "promptToInstall": true,
      "debug": true,
      "diagnostics": false,
      "lang": "",
      "use_stdio": false
    }
    

    Could you confirm whether the languageserver shows such log?

  7. ManuelHentschel commented on Sep 14, 2022

    @ManuelHentschel
    Member

    With diagnostics enabled I get

    [2022-09-14 09:33:25.154] settings  {
      "enabled": true,
      "args": [],
      "promptToInstall": true,
      "debug": true,
      "diagnostics": true,
      "lang": "",
      "use_stdio": false
    }
    

    With diagnostics disabled I get

    [2022-09-14 09:32:22.208] settings  {
      "enabled": true,
      "args": [],
      "promptToInstall": true,
      "debug": true,
      "diagnostics": false,
      "lang": "",
      "use_stdio": false
    }
    

    In both cases I get the following linter message in an empty file:

    Trailing blank lines are superfluous.
    [{
    	"resource": "XXXXXX/temp/test.R",
    	"owner": "_generated_diagnostic_collection_name_#0",
    	"severity": 2,
    	"message": "Trailing blank lines are superfluous.",
    	"source": "trailing_blank_lines_linter",
    	"startLineNumber": 1,
    	"startColumn": 1,
    	"endLineNumber": 1,
    	"endColumn": 2
    }]
    
    (namespaces from the log)
      "namespaces": {
        "processx": "3.5.2",
        "compiler": "4.1.0",
        "R6": "2.5.1",
        "graphics": "4.1.0",
        "parallel": "4.1.0",
        "tools": "4.1.0",
        "collections": "0.3.5",
        "utils": "4.1.0",
        "grDevices": "4.1.0",
        "stats": "4.1.0",
        "datasets": "4.1.0",
        "xml2": "1.3.2",
        "stringi": "1.7.5",
        "callr": "3.7.0",
        "methods": "4.1.0",
        "jsonlite": "1.7.3",
        "ps": "1.6.0",
        "base": "4.1.0",
        "languageserver": "0.3.13"
      },
    

    However, I can disable the linter using options(languageserver.diagnostics = FALSE). This does not show up in the log (i.e. it still shows "diagnostics": true, but disables the linter.

  8. albert-ying commented on Sep 19, 2022

    @albert-ying

    Same problem here for MacOS. Also, I'm wondering if there is a way to disable all styling linters but keep the syntax errors.

  9. kongdd commented on Sep 20, 2022

    @kongdd

    Even trough r.lsp.diagnostics has been disabled, in the workspace setting r.lsp.diagnostics default is true.

  10. dstmu commented on Oct 2, 2022

    @dstmu

    Same here on MacOS. v.2.5.3.

  11. renkun-ken commented on Oct 3, 2022

    @renkun-ken
    Member

    @ManuelHentschel From your languageserver log, it looks like it did receive r.lsp.diagnostics: false but it still publishes diagnostics on document open/save/modify?

  12. renkun-ken commented on Oct 3, 2022

    @renkun-ken
    Member

    Same problem here for MacOS. Also, I'm wondering if there is a way to disable all styling linters but keep the syntax errors.

    You could modify your global ~/.lintr or workspace {workspaceFolder}/.lintr to specify linters to be used. If you want to get notified by parse-errors only, you might want to put the following in your lintr config:

    linters: list()
    
  13. renkun-ken commented on Oct 3, 2022

    @renkun-ken
    Member

    Even trough r.lsp.diagnostics has been disabled, in the workspace setting r.lsp.diagnostics default is true.

    Do you mean VS Code workspace settings in {workspaceFolder}/.vscode/settings.json? If you don't have this file, then VS Code will follow the global settings.

  14. renkun-ken commented on Oct 3, 2022

    @renkun-ken
    Member

    Same here on MacOS. v.2.5.3.

    Would you like to confirm that languageserver does receive the settings update to disable diagnostics by taking a look at #1196 (comment)?

  15. vsabarly commented on Oct 12, 2022

    @vsabarly

    Hi, same issue on MacOS v2.6.0.

    With the latest development version of languageserver, it seems that it does receive the setting:

    • diagnostics enabled:
    settings  {
      "enabled": true,
      "args": [],
      "promptToInstall": true,
      "debug": true,
      "diagnostics": true,
      "lang": "",
      "use_stdio": false
    }
    
    • disabled:
    settings  {
      "enabled": true,
      "args": [],
      "promptToInstall": true,
      "debug": true,
      "diagnostics": false,
      "lang": "",
      "use_stdio": false
    }
    

    Actually unticking the "enable diagnostics" setting works but the diagnostics appear again when VS code is restarted (and I have to check / uncheck the setting again to make them disappear).

  16. mihaiconstantin commented on Oct 13, 2022

    @mihaiconstantin

    It seems related to REditorSupport/languageserver#570. So far, I've been following @renkun-ken's suggestion in #1196 (comment) or using v2.5.2 as workarounds.

  17. renkun-ken commented on Oct 13, 2022

    @renkun-ken
    Member

    Now I can reproduce the problem. Let me take a closer look. Looks like the diagnostics are triggered before the settings are received.

    
    [2022-10-13 17:31:12.688] did open: {
      "uri": "file:///home/ken/Workspaces/languageserver/R/diagnostics.R",
      "version": 1
    }
    
    [2022-10-13 17:31:12.902] diagnostics session acquired session_id = 1 remain pool size = 2
    
    [2022-10-13 17:31:12.904] diagnostics session ready 1 2022-10-13 17:31:12
    
    [2022-10-13 17:31:13.025] parse session released session_id = 2 remain pool size = 1
    
    [2022-10-13 17:31:13.025] parse_callback called: {
      "uri": "file:///home/ken/Workspaces/languageserver/R/capabilities.R",
      "version": null
    }
    
    [2022-10-13 17:31:13.053] parse task timing: 0.703200817108154   file:///home/ken/Workspaces/languageserver/R/capabilities.R
    
    [2022-10-13 17:31:13.102] received:  Content-Length: 208
    
    [2022-10-13 17:31:13.113] received payload.
    
    [2022-10-13 17:31:13.113] handling notification:  workspace/didChangeConfiguration
    
    [2022-10-13 17:31:13.114] settings  {
      "enabled": true,
      "args": [],
      "promptToInstall": true,
      "debug": true,
      "diagnostics": false,
      "lang": "",
      "use_stdio": false
    }
    
  18. renkun-ken commented on Oct 13, 2022

    @renkun-ken
    Member
  19. mihaiconstantin commented on Oct 13, 2022

    @mihaiconstantin

    Thanks, @renkun-ken! I checked via remotes::install_github("renkun-ken/languageserver@drop-diagnostics") and it works as expected!

  20. dstmu commented on Oct 13, 2022

    @dstmu

    Same here. @drop-diagnostics fixes the issue. Thank you!

  21. vsabarly commented on Oct 13, 2022

    @vsabarly

    Thanks a lot!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions