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

[feature request]: format selected range with diagnostic-languageserver #57

Open
hereGittyGitty opened this issue May 19, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@hereGittyGitty
Copy link

Hi iamcoo,

thx a lot for 'diagnostic-languageserver'. I am trying to format visually selected python code with black or autopep8. Whenever I try to trigger the formatting with the mapping

vmap <leader>p  <Plug>(coc-format-selected)
nmap <leader>p  <Plug>(coc-format-selected)

I get the following error:

Notification error: formatSelected [ 'V' ] Error: formatRange provider not found for current buffer, your language server doesn't support it.

Formatting the whole file with the command

command! -nargs=0 Format :call CocAction('format')

works without a problem.

I did not find any related issues neither here on this site nor by using Google. Therefore I guess it must be a problem that might be only affecting me?

Here is the diagnostic-languageserver part of my coc-settings.json file that looks as unspectacular as my formatting mappings above:

{
  "languageserver": {
    "dls": {
      "command": "diagnostic-languageserver",
      "args": ["--stdio"],
      "filetypes": ["python"],
      "trace.server": "verbose",
      "initializationOptions": {
        "linters": {
          "pylint": {
            "sourceName": "pylint",
            "command": "pylint",
            "args": [
              "--output-format",
              "text",
              "--score",
              "no",
              "--msg-template",
              "'{line}:{column}:{category}:{msg} ({msg_id}:{symbol})'",
              "%file"
            ],
            "formatPattern": [
              "^(\\d+?):(\\d+?):([a-z]+?):(.*)$",
              {
                "line": 1,
                "column": 2,
                "security": 3,
                "message": 4
              }
            ],
            "rootPatterns": [".vim", ".git", "pyproject.toml", "setup.py"],
            "securities": {
              "informational": "hint",
              "refactor": "info",
              "convention": "info",
              "warning": "warning",
              "error": "error",
              "fatal": "error"
            },
            "offsetColumn": 1,
            "formatLines": 1
          }
        },
        "formatters": {
          "autopep8": {
            "command": "autopep8",
            "args": ["-"]
          },
          "black": {
            "command": "black",
            "args": ["--quiet", "-"]
          },
          "isort": {
            "command": "isort",
            "args": ["--quiet", "-"]
          }
        },
        "filetypes": {
          "python": "pylint"
        },
        "formatFiletypes": {
          "python": ["autopep8", "isort"]
        }
      }
    }
  }
}

Thank you very much for any help. If you need any more input just ask.

@iamcco
Copy link
Owner

iamcco commented May 20, 2021

It's possible but not support yet.

@hereGittyGitty
Copy link
Author

hereGittyGitty commented May 20, 2021

Good to know so I will stop trying. Are there any plans to implement that feature in the near future? Otherwise I will look for an alternative for that exact feature in the meantime. Do you want me to create some kind of enhancement issue?

@iamcco
Copy link
Owner

iamcco commented May 20, 2021

Good to know so I will stop trying. Are there any plans to implement that feature in the near future? Otherwise I will look for an alternative for that exact feature in the meantime. Do you want me to create some kind of enhancement issue?

No plan yet, I don't have time to do that.

@iamcco iamcco changed the title Is 'format selected range' possible with diagnostic-languageserver? [feature request]: format selected range with diagnostic-languageserver May 20, 2021
@iamcco iamcco added the enhancement New feature or request label May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants