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

Add linter configuration to initialization options #855

Open
dbanck opened this issue Apr 7, 2022 · 1 comment · May be fixed by #1738
Open

Add linter configuration to initialization options #855

dbanck opened this issue Apr 7, 2022 · 1 comment · May be fixed by #1738
Labels
enhancement New feature or request linting Functionality related to linting and external linters

Comments

@dbanck
Copy link
Member

dbanck commented Apr 7, 2022

This is part of hashicorp/vscode-terraform#635

Use-cases

To enable the integration of linters within the language server, we need to accept a set of configurations upon initialization.

Proposal

  • Extend the initialization properties with the linter related configuration.

properties := map[string]interface{}{
"experimentalCapabilities.referenceCountCodeLens": false,
"options.rootModulePaths": false,
"options.excludeModulePaths": false,
"options.commandPrefix": false,
"options.ignoreDirectoryNames": false,
"options.experimentalFeatures.validateOnSave": false,
"options.terraformExecPath": false,
"options.terraformExecTimeout": "",
"options.terraformLogFilePath": false,
"root_uri": "dir",
"lsVersion": serverCaps.ServerInfo.Version,
}

  • Each linter will have a dedicated section in the configuration
  • The first linter we plan to support is tflint, new options might look like this:
    • options.linters.tflint.binaryPath
    • options.linters.tflint.binaryFlags
    • options.linters.tflint.lintOnSave
  • Validate the linter configuration and check if the passed binary is accessible and executable
  • If validation fails, fail silently and disable any internal linting code
  • If validation succeeds, the linters can be consumed on safe or via a command (separate issues)
@radeksimko
Copy link
Member

radeksimko commented Jul 22, 2022

Just noting here that the settings here should ideally follow the principles outlined as part of #1010

i.e. on the LS side this could look like this

{
  "linters": {
    "tflint": {
      "binaryPath": "",
      "binaryFlags": [""],
      "lintOnSave": true
    }
  }
}

and VS Code may expose the same options as

{
  "linters.tflint.binaryPath": "",
  "linters.tflint.binaryFlags": [""],
  "linters.tflint.lintOnSave": true

@xiehan xiehan added the linting Functionality related to linting and external linters label Apr 21, 2023
@wata727 wata727 linked a pull request Jun 23, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request linting Functionality related to linting and external linters
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants