csharp-language-server-protocol icon indicating copy to clipboard operation
csharp-language-server-protocol copied to clipboard

Issue trying to implement codeAction/resolve in omnisharp-roslyn

Open razzmatazz opened this issue 4 years ago • 1 comments

I am sure I am missing something (maybe I just don't understand dynamic registration) but I am not able to implement codeAction/resolve in omnisharp-roslyn.

The first thing that makes me confused is why omnisharp-roslyn reports no codeActionProvider as response to initialize, as evidenced by this log:

[Trace - 01:25:24 PM] Received response 'initialize - (19)' in 768ms.
Result: {
  "serverInfo": {
    "version": "1.0.0+c802f8ea91d8ab24d07564c917d0bab8326b3f71",
    "name": "OmniSharp"
  },
  "capabilities": {
    "workspace": {
      "fileOperations": {
      },
      "workspaceFolders": {
        "changeNotifications": true,
        "supported": true
      }
    },
    "implementationProvider": {
    },
    "experimental": {
    },
    "executeCommandProvider": {
      "commands": [
        "omnisharp/executeCodeAction",
        "omnisharp/executeCodeAction"
      ]
    },
    "documentOnTypeFormattingProvider": {
      "moreTriggerCharacter": [
        "}",
        ")"
      ],
      "firstTriggerCharacter": ";"
    },
    "codeLensProvider": {
      "resolveProvider": true
    },
    "workspaceSymbolProvider": {
    },
    "documentSymbolProvider": {
    },
    "referencesProvider": {
    },
    "definitionProvider": {
    },
    "signatureHelpProvider": {
      "triggerCharacters": [
        ".",
        "?",
        "["
      ]
    },
    "completionProvider": {
      "triggerCharacters": [
        "."
      ]
    },
    "hoverProvider": {
    },
    "textDocumentSync": {
      "save": {
        "includeText": true
      },
      "change": 1,
      "openClose": true
    }
  }

Then I tried to implement codeAction/resolve support here:

  • https://github.com/razzmatazz/omnisharp-roslyn/commit/04ed94b43198d24c72fa58e66154c247e6e02cbe

But I really not sure if I am dabbling in the right direction, do we really need separate OmniSharpCodeActionResolveHandler or not -- and can I use data on CodeAction? -- it seems to be serialized properly though so I assume it is.

razzmatazz avatar Jan 31 '21 11:01 razzmatazz

So the registrations that is reported at initialization are static registrations only. If we return the registration data there, and then dynamically register as well, we end up with two registrations.

Some of the newer features support the ability to define the dynamic registrations statically and give them an id, that is not yet supported.

david-driscoll avatar Feb 28 '21 03:02 david-driscoll