Skip to content
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

Investigate LSP support on Windows #25

Closed
jiribenes opened this issue Sep 17, 2024 · 9 comments · Fixed by #20
Closed

Investigate LSP support on Windows #25

jiribenes opened this issue Sep 17, 2024 · 9 comments · Fixed by #20
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@jiribenes
Copy link
Contributor

jiribenes commented Sep 17, 2024

On Windows, the extension packaged from #20 gets stuck somewhere when starting the LSP server: image

On a "Restart LSP server" command, it shows:
image

Again, note that this might be because of #20, you should better test anew with & without it.
It might be useful to use the [helpful, albeit fiddly] debug mode Effekt LSP offers.

@jiribenes jiribenes added bug Something isn't working help wanted Extra attention is needed labels Sep 17, 2024
@OriginalCpp
Copy link

I am using Windows.

  1. I installed the compiler and then the extension from the vs code marketplace and got the following error when opening an Effekt-file:
    image
  2. I debugged the extension after cloning the repository and got the following:
    image_480

For further testing, I would need some instructions because I don't know much wether about vs code extensions nor about language servers and Effekt

@jiribenes
Copy link
Contributor Author

jiribenes commented Sep 26, 2024

Hi @OriginalCpp, thanks for tackling this.
First, I have a few questions:

  1. Is Effekt installed? (can you run effekt in the console?)
  2. By the way, do you use WSL2 with VSCode or not? :) (this is just for my info)

If there are still problems (please check both the main branch [= the current released version of the extension] and the branch in #20), here are first steps:

  1. For debugging/running the extension, you might need to run npm install in the effekt-vscode folder (to get all of the developer dependencies). You can also just build it using vsce, see the CI for more details.
  2. For debugging the language server part, you can use the debug option in the config of the VSCode extension:
Screenshot 2024-09-26 at 11 56 22

Based on the code that added it 29dd4ae, I think that when using this mode, you need to run the Effekt LSP separately with effekt --server --debug as per: https://github.com/effekt-lang/kiama/blob/ab6aef78fc4ce99a9ad2db8555718d00b03f7b8a/jvm/src/main/scala/kiama/util/Server.scala#L100-L120

If everything works on your machine for both the main and #20, let me know :)
Please post your questions/progress here.

@OriginalCpp
Copy link

I checked if I installed Effekt, and indeed I have:
image
I use WSL2 with VSCode for a Cpp Course I will take soon, but usually I do not use it. When testing this I was also not connected to the WSL

Main

I had to run the LSP seperately when the Debug option was activated. Then debugged the extension, opening an effekt-file and everything worked, but in the console there were some warnings:
image

#20

Also ran the LSP seperately, everything worked fine:
image
image

@jiribenes
Copy link
Contributor Author

Thanks for the update, what's the status of the issue then? Does it work without the debug flag for you?

@OriginalCpp
Copy link

Without the debug option enabled:

Main

image

#20

image

@jiribenes
Copy link
Contributor Author

jiribenes commented Sep 27, 2024

Could you try setting your Effekt executable in the plugin settings to effekt.sh or effekt.cmd or effekt.ps1 (or other options you can find in the same folder where Effekt installed (where/which effekt)?

Also, could you try investigating around for a source of the spawn EINVAL?
Could it be something like this? https://code.visualstudio.com/updates/v1_92#_electron-30-update
If so, can we go around it? (Here's some quick workaround I found: https://github.com/microsoft/vscode-vsce/blob/main/src/package.ts#L409, but I'm not sure where to apply it here)

Could you also see if it can be caused by too recent / too old Node.js version?

Thanks!

@OriginalCpp
Copy link

OriginalCpp commented Sep 28, 2024

#20

.cmd

The testing in my last post, I already set the Effekt executable to effekt.cmd:
image
image

.sh

When using the effekt.sh endless powershell windows kept opening and I got the following errors:
image
image
image

.ps1

It somehow randomly opens the file .ps1 in the editor too.
And I get similar errors:
image

.sh.cmd

Somehow when setting it to this, it does not find the path:
image

.sh.ps1

As with .ps1 it keeps opening the file. Also not working, "Effekt Server has stopped" and not even any errors anywhere reported.

Main

.cmd

Already tested earlier

.sh

Same problem as with #20 testing. I do not think testing the other file extensions would deliver any other results.

Node.js version

image

Spawn EINVAL

The fix you mentioned includes this https://stackoverflow.com/a/78532006, so maybe it is fixed if the shell: true option gets added where the process is spawned. I can't seem to find that line though to try it.

@jiribenes jiribenes assigned jiribenes and unassigned OriginalCpp Sep 29, 2024
jiribenes added a commit that referenced this issue Sep 29, 2024
@jiribenes
Copy link
Contributor Author

Should be fixed by the following commit (now live on #20): 71ae96e
If needed, we can cherry-pick it to master directly.

@jiribenes jiribenes linked a pull request Sep 29, 2024 that will close this issue
4 tasks
@OriginalCpp
Copy link

OriginalCpp commented Sep 30, 2024

Yes, now it works on my machine (using the effekt.cmd in the options).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants