palantir/python-language-server

Capabilities still says formatting not available, even though available

bkhl opened this issue · 1 comments

bkhl commented

Using the Eglot addon to Emacs I tried using formatting withpyls-black and pyls-isort.

Eglot will refuse to do so, saying Server can't format, because the capabilities reported on startup says false for the capabilities textDocument/formatting and textDocument/rangeFormatting:

{
   "jsonrpc":"2.0",
   "id":1,
   "method":"initialize",
   "params":{
      "processId":"None",
      "rootPath":"/tmp/testproject/",
      "rootUri":"file:///tmp/testproject",
      "initializationOptions":{

      },
      "capabilities":{
         "workspace":{
            "applyEdit":true,
            "executeCommand":{
               "dynamicRegistration":false
            },
            "workspaceEdit":{
               "documentChanges":false
            },
            "didChangeWatchedFiles":{
               "dynamicRegistration":true
            },
            "symbol":{
               "dynamicRegistration":false
            },
            "configuration":true
         },
         "textDocument":{
            "synchronization":{
               "dynamicRegistration":false,
               "willSave":true,
               "willSaveWaitUntil":true,
               "didSave":true
            },
            "completion":{
               "dynamicRegistration":false,
               "completionItem":{
                  "snippetSupport":false
               },
               "contextSupport":true
            },
            "hover":{
               "dynamicRegistration":false,
               "contentFormat":[
                  "markdown",
                  "plaintext"
               ]
            },
            "signatureHelp":{
               "dynamicRegistration":false,
               "signatureInformation":{
                  "parameterInformation":{
                     "labelOffsetSupport":true
                  },
                  "activeParameterSupport":true
               }
            },
            "references":{
               "dynamicRegistration":false
            },
            "definition":{
               "dynamicRegistration":false
            },
            "declaration":{
               "dynamicRegistration":false
            },
            "implementation":{
               "dynamicRegistration":false
            },
            "typeDefinition":{
               "dynamicRegistration":false
            },
            "documentSymbol":{
               "dynamicRegistration":false,
               "hierarchicalDocumentSymbolSupport":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
                  ]
               }
            },
            "documentHighlight":{
               "dynamicRegistration":false
            },
            "codeAction":{
               "dynamicRegistration":false,
               "codeActionLiteralSupport":{
                  "codeActionKind":{
                     "valueSet":[
                        "quickfix",
                        "refactor",
                        "refactor.extract",
                        "refactor.inline",
                        "refactor.rewrite",
                        "source",
                        "source.organizeImports"
                     ]
                  }
               },
               "isPreferredSupport":true
            },
            "formatting":{
               "dynamicRegistration":false
            },
            "rangeFormatting":{
               "dynamicRegistration":false
            },
            "rename":{
               "dynamicRegistration":false
            },
            "publishDiagnostics":{
               "relatedInformation":false
            }
         },
         "experimental":{

         }
      }
   }
}

So, it seems that these capabilities should say true, if plugins providing formatting are available.

I guess this also means there should be a way for plugins to signal that they provide certain capabilities.

bkhl commented

Seems I misunderstood how this works a bit, the issue appears to be on the client side here.