ghdl / ghdl-language-server

Language server based on ghdl
MIT License
88 stars 8 forks source link

setup of VS-Code-Extension #153

Open jakobjung10 opened 1 year ago

jakobjung10 commented 1 year ago

Hello everyone!

As i am new to the topic in general, i would be happy about getting support in order to get the VS-Code extension running.

My steps so far:

When executing the command vsce package, i get the following message:

PS C:\Users\Jakob\Documents\GitHub\ghdl-language-server> vsce package ERROR Extension manifest not found: C:\Users\Jakob\Documents\GitHub\ghdl-language-server\package.json

The README-files from the ghdl and ghdl-language-server cause confusion for me. Should the extension work out of the box or are there any previous steps required? If yes, which steps have to be done?

My actual goal is to execute the extension in debug-mode. (vsce package should not be necessary, as it just packages the extension, so the above listed steps might be a bit misleading for my actual goal)... When i press F5 in VS-Code, nothing happens (i am expecting a new window to be launched with activated extension).

Thanks in advance for instructions to get the extension running!

tgingold commented 1 year ago

I think you need to do: cd vscode-client before vsce package

jakobjung10 commented 1 year ago

I think you need to do: cd vscode-client before vsce package

PS C:\Users\Jakob\Documents\GitHub\ghdl-language-server\vscode-client> vsce package
ERROR You should not depend on 'vscode' in your 'dependencies'. Did you mean to add it to 'devDependencies'?

I haven't changed anything in the package.json file? Maybe it should be moved to devDependencies... (i haven't done this so far to avoid any unnecessary trouble)

However, at the moment i am more interested in how to debug the extension (nothing happens, when i press F5...

tgingold commented 1 year ago

What is your content of package.json ? Because in the repo, it is not in dependencies:

https://github.com/ghdl/ghdl-language-server/blob/master/vscode-client/package.json

I don't think you can debug it without first building it.

jakobjung10 commented 1 year ago

oh, you are right... (Below is a section of the code)

"engines": { "vscode": "^1.73.1" }, "devDependencies": { "@types/node": "^18.11.18", "@types/vscode": "^1.73.1", "ts-loader": "^9.4.2", "tslint": "^6.1.3", "typescript": "^4.9.5", "webpack": "^5.75.0", "webpack-cli": "^5.0.0" }, "dependencies": { "vscode": "^1.1.34", "vscode-languageclient": "^7.0.0" }

I didn't add it manually though... (i have removed it again)

Now, a file named vhdl-lsp-0.1.0-dev.vsix was created. :)

What's the next step, as still nothing happens by pressing F5 ?

tgingold commented 1 year ago

You have to install it:

code --install-extension vhdl-lsp-*.vsix

I am not sure what do you mean by debugging it. A long time ago, I read a webpage explaining how to debug a vscode extension.

jakobjung10 commented 1 year ago

code --install-extension vhdl-lsp-*.vsix

Okay, i executed the given command and in C:\Users\Jakob\.vscode\extensions, a folder named tgingold.vhdl-lsp-0.1.0-dev was created.

Now, i can see the extension in the extensions-menu in vscode. When i activate the extension, i get the following message: The VHDL Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted.

Also, in the Output-Window in VS-Code, there are many errors mainly about libghdl.

At the moment, there are 2 questions from different perspectives

End-user-experience

Developer-Experience

I am not sure what do you mean by debugging it. A long time ago, I read a webpage explaining how to debug a vscode extension.

tgingold commented 1 year ago

You also need to install ghdl, the pyGHDL python packages and ghdl-ls python tool (from the ghdl repo).

• Typically, before you package your extension, you would test your extension, debug, step through the extension when searching for errors etc... From other extensions i have experienced that you don't have to package the extension for testing purposes. You can start it in Debug mode, then a new vs-code window gets launched and you can test your extension. This is what i want to do.

I think you can do that, although I haven't done it recently. But most of the extension is based on the separate ghdl-ls tool, which has its own testing suite.

jakobjung10 commented 1 year ago

Probably these websites should help me, but advice would be good

https://ghdl.github.io/ghdl/getting.html https://ghdl.github.io/ghdl/development/building/index.html

tgingold commented 1 year ago

pyGHDL depends on libghdl (hence the error message). We are working on the generation of a standalone pyGHDL wheel, but currently you first need to install ghdl to use pyGHDL. The instructions you pointed to are the correct one.

(You can probably download the standalone wheel from the artifacts of a github action too).