Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Announce supported capabilities #391

Closed
predragnikolic opened this issue Aug 20, 2021 · 1 comment
Closed

Announce supported capabilities #391

predragnikolic opened this issue Aug 20, 2021 · 1 comment
Labels
question Further information is requested

Comments

@predragnikolic
Copy link
Contributor

predragnikolic commented Aug 20, 2021

LSP clients(like Sublime Text), won't send server requests if the server didn't announce support for those requests through capabilities.

Currently the Volar server only announces this capability:
https://github.com/johnsoncodehk/volar/blob/8733e9483389d9567525f0493b56697fe8f2c35a/packages/server/src/index.ts#L34-L36

But it should actually include lots of other capabilities.
Here is an example of what the Vetur server returns:

Note: I accidentally lowercased all the object keys :)

{
	"capabilities": {
		"foldingrangeprovider": true,
		"codeactionprovider": {
			"codeactionkinds": ["quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeimports"],
			"resolveprovider": true
		},
		"signaturehelpprovider": {
			"triggercharacters": ["("] 
		},
		"colorprovider": true,
		"semantictokensprovider": {
			"legend": {
				"tokenmodifiers": ["declaration", "static", "async", "readonly", "defaultlibrary", "local", "refvalue"],
				"tokentypes": ["class", "enum", "interface", "namespace", "typeparameter", "type", "parameter", "variable", "enummember", "property", "function", "method"]
			},
			"range": true,
			"full": true
		},
		"workspace": {
			"fileoperations": {
				"willrename": {
					"filters": [
						{
							"pattern": {
								"glob": "**/*.{ts,js,vue}"
							}
						}
					]
				}
			},
			"workspacefolders": {
				"changenotifications": true,
				"supported": true
			}
		},
		"completionprovider": {
			"triggercharacters": [".", ":", "<", "\"", "'", "/", "@", "*", " "],
			"resolveprovider": true
		},
		"hoverprovider": true,
		"executecommandprovider": {
			"commands": []
		},
		"documentlinkprovider": {
			"resolveprovider": false
		},
		"referencesprovider": true,
		"definitionprovider": true,
		"documenthighlightprovider": true,
		"textdocumentsync": {
			"didclose": {},
			"save": {},
			"didopen": {},
			"change": {
				"synckind": 2
			}
		},
		"documentformattingprovider": false,
		"documentsymbolprovider": true
	}
}

Additional context:

Even when I add a completion capability for completions:

	const result: vscode.InitializeResult = {
		capabilities: {
			textDocumentSync: vscode.TextDocumentSyncKind.Incremental,
			completionProvider: {
				triggerCharacters: ['.']
			}
		}
	};

When a LSP client sends a request to Volar,
Volar returns this error:

Client sends a request to volar:
:: --> LSP-volar textDocument/completion(5): {'position': {'line': 0, 'character': 0}, 'textDocument': {'uri': 'file:///home/predragnikolic/.config/sublime-text/Packages/LSP-volar/index.vue'}}

Volar sends back this:
:: <~~ LSP-volar 5: {'message': 'Unhandled method textDocument/completion', 'code': -32601}

So even when Volar has specified capabilities, the server still will not work with other LSP clients (just yet :). Do you have any idea why?

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Aug 20, 2021

You need to config which features should enable by initializationOptions in language client, because volar split language features to two TS language server to resolved request blocking. (#390)

See https://github.com/yaegassy/coc-volar/blob/master/src/index.ts#L129-L182.

@johnsoncodehk johnsoncodehk added the question Further information is requested label Aug 20, 2021
@vuejs vuejs locked and limited conversation to collaborators Aug 20, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants