Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Provide Support for CodeActions without command #239

Closed
cdietrich opened this issue Nov 4, 2018 · 6 comments · Fixed by #243
Closed

Provide Support for CodeActions without command #239

cdietrich opened this issue Nov 4, 2018 · 6 comments · Fixed by #243

Comments

@cdietrich
Copy link
Contributor

the current LSP states for code actions

result: (Command | CodeAction)[] | null where CodeAction is defined as follows ...

it looks like the current adaper only supports the Command return type style.
i am getting following error is server answers with CodeActions directly

The accessor 'ExecuteCommandParams.getCommand()' must return a non-null value. Path: $.params.command
/Users/dietrich/git/solidity-ide/extensions/atom/node_modules/atom-languageclient/build/lib/logger.js:12 Solidity (Solidity Language Server) rpc.sendRequest workspace/executeCommand threw Error: The accessor 'ExecuteCommandParams.getCommand()' must return a non-null value. Path: $.params.command
    at new ResponseError (/Users/dietrich/git/solidity-ide/extensions/atom/node_modules/vscode-jsonrpc/lib/messages.js:46:28)
    at handleResponse (/Users/dietrich/git/solidity-ide/extensions/atom/node_modules/vscode-jsonrpc/lib/main.js:430:48)
    at processMessageQueue (/Users/dietrich/git/solidity-ide/extensions/atom/node_modules/vscode-jsonrpc/lib/main.js:258:17)
    at Immediate._onImmediate (/Users/dietrich/git/solidity-ide/extensions/atom/node_modules/vscode-jsonrpc/lib/main.js:242:13)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)
@cdietrich
Copy link
Contributor Author

here is how the responses look like

[{"title":"Change to ^0.4.25","diagnostics":[{"range":{"start":{"line":0,"character":16},"end":{"line":0,"character":23}},"severity":2,"code":"WARNING_SOLIDITY_VERSION_NOT_THE_DEFAULT","source":"Solidity (Solidity Language Server)","message":"Solidity version does not match the default version (^0.4.25)"}],"edit":{"changes":{"file:///Users/dietrich/git/solidity-ide/extensions/atom/lala/demo.sol":[{"range":{"start":{"line":0,"character":16},"end":{"line":0,"character":23}},"newText":"^0.4.25"}]}}}]

@damieng
Copy link
Contributor

damieng commented Nov 5, 2018

I suspect this was a change in the LSP that is reflected in newer versions of the vscode-language-server library. The next version of atom-languageclient (currently in master) uses a much newer version - could you try that and see if it works for you?

Just git checkout this repo and then npm i and npm link it. Then npm link atom-languageclient inside your ide-x package to link the master version across.

@cdietrich
Copy link
Contributor Author

how can i try the new version locally (am not familar with npm so a hint how i can pull the master version of the libary and or link it into my extension would be nice)

@damieng
Copy link
Contributor

damieng commented Nov 5, 2018

git clone git@github.com:/atom/atom-languageclient.git
cd atom-languageclient
npm i
npm link
cd whatever-ide-package-you-are-using
npm link atom-languageclient

Once you're done testing you can just

cd whatever-ide-package-you-are-using
npm unlink atom-languageclient
apm i

To go back to the previous version of atom-languageclient

Hope that helps.

@cdietrich
Copy link
Contributor Author

cdietrich commented Nov 5, 2018

Hi,

i am still getting the same error message.
but i am not sure if my change is correct.

you can find my code here: (you need java installed)

git clone https://github.com/itemis/xtext-languageserver-example.git
cd xtext-languageserver-example
git checkout cd_codeActionAtom
./gradlew clean build vscodeExtension atomExtension
cd atom-extension
apm link --dev; atom -d "$(pwd)/../demo/"

if you open a mydsl file and have a greeting like

Hello lowercase!
you should get a warning with a quickfix

cdietrich added a commit to cdietrich/atom-languageclient that referenced this issue Nov 5, 2018
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
@cdietrich
Copy link
Contributor Author

indeed the new service is only available with even newer dependencies.
and we need some impl for the new service.
unfortunately my typescript knowledge is very limited, so i dont know if something like the following makes sense cdietrich@f7a09b3

cdietrich added a commit to cdietrich/atom-languageclient that referenced this issue Nov 5, 2018
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
cdietrich added a commit to cdietrich/atom-languageclient that referenced this issue Nov 14, 2018
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
cdietrich added a commit to cdietrich/atom-languageclient that referenced this issue Nov 14, 2018
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
damieng added a commit that referenced this issue Nov 14, 2018
added impl for new code action service. fixes #239
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants