Skip to content
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

Improve handling configuration settings #439

Merged
merged 7 commits into from
Jun 22, 2021
Merged

Improve handling configuration settings #439

merged 7 commits into from
Jun 22, 2021

Conversation

randy3k
Copy link
Member

@randy3k randy3k commented Jun 9, 2021

  1. Allows settings to be passed via workspace/didChangeConfiguration.
  2. Additionally, options(languageserver.xxxx) has always higher precedence to allow projectwise override.
  3. Also added setting rich_documentaion for less powerful markdown renderer.

Discussion: do we want to set rich_documentaion to default FALSE and enable it manually in vscode-r-lsp?

snippet_support = TRUE,
max_completions = 200,
lint_cache = TRUE,
server_capabilities = list(),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should have an individual switch for each provider rather than to expose the capabilities.

@randy3k randy3k changed the title [WIP] Improve handling configuration settings Improve handling configuration settings Jun 21, 2021
@randy3k randy3k requested a review from renkun-ken June 21, 2021 06:12
Copy link
Member

@renkun-ken renkun-ken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@renkun-ken
Copy link
Member

BTW, do we want to support workspace/didChangeConfiguration?

@renkun-ken
Copy link
Member

Discussion: do we want to set rich_documentaion to default FALSE and enable it manually in vscode-r-lsp?

I guess we could consider this if more users complain about it?

@randy3k
Copy link
Member Author

randy3k commented Jun 21, 2021

BTW, do we want to support workspace/didChangeConfiguration?

We have supported it already.

workspace_did_change_configuration <- function(self, params) {

@randy3k
Copy link
Member Author

randy3k commented Jun 21, 2021

Discussion: do we want to set rich_documentaion to default FALSE and enable it manually in vscode-r-lsp?

I guess we could consider this if more users complain about it?

We could also check MarkdownClientCapabilities. I assume that vscode will return marked.

@renkun-ken
Copy link
Member

renkun-ken commented Jun 21, 2021

Here is the initialization config from latest vscode:

{
  "processId": 35022,
  "clientInfo": {
    "name": "Visual Studio Code",
    "version": "1.57.1"
  },
  "locale": "en",
  "rootPath": "/home/ken/test",
  "rootUri": "file:///home/ken/test",
  "capabilities": {
    "workspace": {
      "applyEdit": true,
      "workspaceEdit": {
        "documentChanges": true,
        "resourceOperations": [
          "create",
          "rename",
          "delete"
        ],
        "failureHandling": "textOnlyTransactional",
        "normalizesLineEndings": true,
        "changeAnnotationSupport": {
          "groupsOnLabel": true
        }
      },
      "didChangeConfiguration": {
        "dynamicRegistration": true
      },
      "didChangeWatchedFiles": {
        "dynamicRegistration": true
      },
      "symbol": {
        "dynamicRegistration": true,
        "symbolKind": {
          "valueSet": [
            1,
            2,
            3,
            4,
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20,
            21,
            22,
            23,
            24,
            25,
            26
          ]
        },
        "tagSupport": {
          "valueSet": [
            1
          ]
        }
      },
      "codeLens": {
        "refreshSupport": true
      },
      "executeCommand": {
        "dynamicRegistration": true
      },
      "configuration": true,
      "workspaceFolders": true,
      "semanticTokens": {
        "refreshSupport": true
      },
      "fileOperations": {
        "dynamicRegistration": true,
        "didCreate": true,
        "didRename": true,
        "didDelete": true,
        "willCreate": true,
        "willRename": true,
        "willDelete": true
      }
    },
    "textDocument": {
      "publishDiagnostics": {
        "relatedInformation": true,
        "versionSupport": false,
        "tagSupport": {
          "valueSet": [
            1,
            2
          ]
        },
        "codeDescriptionSupport": true,
        "dataSupport": true
      },
      "synchronization": {
        "dynamicRegistration": true,
        "willSave": true,
        "willSaveWaitUntil": true,
        "didSave": true
      },
      "completion": {
        "dynamicRegistration": true,
        "contextSupport": true,
        "completionItem": {
          "snippetSupport": true,
          "commitCharactersSupport": true,
          "documentationFormat": [
            "markdown",
            "plaintext"
          ],
          "deprecatedSupport": true,
          "preselectSupport": true,
          "tagSupport": {
            "valueSet": [
              1
            ]
          },
          "insertReplaceSupport": true,
          "resolveSupport": {
            "properties": [
              "documentation",
              "detail",
              "additionalTextEdits"
            ]
          },
          "insertTextModeSupport": {
            "valueSet": [
              1,
              2
            ]
          }
        },
        "completionItemKind": {
          "valueSet": [
            1,
            2,
            3,
            4,
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20,
            21,
            22,
            23,
            24,
            25
          ]
        }
      },
      "hover": {
        "dynamicRegistration": true,
        "contentFormat": [
          "markdown",
          "plaintext"
        ]
      },
      "signatureHelp": {
        "dynamicRegistration": true,
        "signatureInformation": {
          "documentationFormat": [
            "markdown",
            "plaintext"
          ],
          "parameterInformation": {
            "labelOffsetSupport": true
          },
          "activeParameterSupport": true
        },
        "contextSupport": true
      },
      "definition": {
        "dynamicRegistration": true,
        "linkSupport": true
      },
      "references": {
        "dynamicRegistration": true
      },
      "documentHighlight": {
        "dynamicRegistration": true
      },
      "documentSymbol": {
        "dynamicRegistration": true,
        "symbolKind": {
          "valueSet": [
            1,
            2,
            3,
            4,
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20,
            21,
            22,
            23,
            24,
            25,
            26
          ]
        },
        "hierarchicalDocumentSymbolSupport": true,
        "tagSupport": {
          "valueSet": [
            1
          ]
        },
        "labelSupport": true
      },
      "codeAction": {
        "dynamicRegistration": true,
        "isPreferredSupport": true,
        "disabledSupport": true,
        "dataSupport": true,
        "resolveSupport": {
          "properties": [
            "edit"
          ]
        },
        "codeActionLiteralSupport": {
          "codeActionKind": {
            "valueSet": [
              "",
              "quickfix",
              "refactor",
              "refactor.extract",
              "refactor.inline",
              "refactor.rewrite",
              "source",
              "source.organizeImports"
            ]
          }
        },
        "honorsChangeAnnotations": false
      },
      "codeLens": {
        "dynamicRegistration": true
      },
      "formatting": {
        "dynamicRegistration": true
      },
      "rangeFormatting": {
        "dynamicRegistration": true
      },
      "onTypeFormatting": {
        "dynamicRegistration": true
      },
      "rename": {
        "dynamicRegistration": true,
        "prepareSupport": true,
        "prepareSupportDefaultBehavior": 1,
        "honorsChangeAnnotations": true
      },
      "documentLink": {
        "dynamicRegistration": true,
        "tooltipSupport": true
      },
      "typeDefinition": {
        "dynamicRegistration": true,
        "linkSupport": true
      },
      "implementation": {
        "dynamicRegistration": true,
        "linkSupport": true
      },
      "colorProvider": {
        "dynamicRegistration": true
      },
      "foldingRange": {
        "dynamicRegistration": true,
        "rangeLimit": 5000,
        "lineFoldingOnly": true
      },
      "declaration": {
        "dynamicRegistration": true,
        "linkSupport": true
      },
      "selectionRange": {
        "dynamicRegistration": true
      },
      "callHierarchy": {
        "dynamicRegistration": true
      },
      "semanticTokens": {
        "dynamicRegistration": true,
        "tokenTypes": [
          "namespace",
          "type",
          "class",
          "enum",
          "interface",
          "struct",
          "typeParameter",
          "parameter",
          "variable",
          "property",
          "enumMember",
          "event",
          "function",
          "method",
          "macro",
          "keyword",
          "modifier",
          "comment",
          "string",
          "number",
          "regexp",
          "operator"
        ],
        "tokenModifiers": [
          "declaration",
          "definition",
          "readonly",
          "static",
          "deprecated",
          "abstract",
          "async",
          "modification",
          "documentation",
          "defaultLibrary"
        ],
        "formats": [
          "relative"
        ],
        "requests": {
          "range": true,
          "full": {
            "delta": true
          }
        },
        "multilineTokenSupport": false,
        "overlappingTokenSupport": false
      },
      "linkedEditingRange": {
        "dynamicRegistration": true
      }
    },
    "window": {
      "showMessage": {
        "messageActionItem": {
          "additionalPropertiesSupport": true
        }
      },
      "showDocument": {
        "support": true
      },
      "workDoneProgress": true
    },
    "general": {
      "regularExpressions": {
        "engine": "ECMAScript",
        "version": "ES2020"
      },
      "markdown": {
        "parser": "marked",
        "version": "1.1.0"
      }
    }
  },
  "trace": "off",
  "workspaceFolders": [
    {
      "uri": "file:///home/ken/test",
      "name": "test"
    }
  ]
}

@renkun-ken
Copy link
Member

Discussion: do we want to set rich_documentaion to default FALSE and enable it manually in vscode-r-lsp?

I guess we could consider this if more users complain about it?

We could also check MarkdownClientCapabilities. I assume that vscode will return marked.

Yes, it would be much nicer. What do other clients show?

@randy3k
Copy link
Member Author

randy3k commented Jun 21, 2021

I believe that most other clients do not return anything.

@randy3k randy3k force-pushed the settings branch 2 times, most recently from ca89d28 to 4a09b68 Compare June 22, 2021 07:46
@randy3k
Copy link
Member Author

randy3k commented Jun 22, 2021

@renkun-ken it seems that there is a problem to enable lint_cache of lintr. Specially, running lintr via callr with cache = TRUE seems to trigger this error in CI:

[2021-06-22 07:36:06.604] diagnostics_task: <callr_status_error: callr subprocess failed: cannot open the connection>
 in process 
-->
<callr_remote_error in gzfile(file, "wb"):
 cannot open the connection>
 in process 5116 

However I could not reproduce it locally.

@renkun-ken
Copy link
Member

Thanks for the fix. Not sure about the cache problem either.

@randy3k randy3k merged commit 7f9a8d6 into master Jun 22, 2021
@randy3k randy3k deleted the settings branch June 22, 2021 14:53
settings | default | description
---- | ----- | -----
`debug` | `false` | increase verbosity for debug purpose
`log_file` | `nil` | file to log debug messages, fallback to stderr if empty
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is nil, not null?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. Too much golang this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants