Shopify / ruby-lsp

An opinionated language server for Ruby
https://shopify.github.io/ruby-lsp/
MIT License
1.35k stars 121 forks source link

RubyLSP problem #1697

Closed Gatoloko44 closed 5 months ago

Gatoloko44 commented 6 months ago

Operating System

Windows 11

Ruby version

ruby 3.2.2

Project has a bundle

Ruby version manager being used

no manager

Description

image yesterday the extension show me this error and i don't make any change in my computer or visual

SaidRasinlic commented 6 months ago

Same problem (Windows 10)! I was about to open this bug too, because nothing seems to work even with the reinstallation of the extension or manually creating my "ruby_lsp_projectName" file in %temp% folder (which shouldn't be done).

Out of nowhere, this happened. Everything seemed to work perfectly until today, when I turned on my PC and got this error, just like you did 🤔

The Ruby LSP output, as seen in the screenshot, indicates that it is only in an attempting state to be activated; there is no detailed message regarding it.

Ruby-LSP-(tmp-error)

akirataguchi115 commented 6 months ago

Same here.

vinistock commented 5 months ago

This is most definitely because of Shopify/vscode-ruby-lsp#918, but I don't understand why it's happening. That PR started using a temporary file to write the Ruby environment activation because some shell configurations take over STDERR and caused issues.

For some reason, writing the temporary file is failing. Either that or it is somehow being deleted before we read it. Trying to figure out why that's happening...

Gatoloko44 commented 5 months ago

I found a solution for this error and it is to update the version of the extension to the preview version and with that the error disappears, I don't know why but it works.

wsethbrown commented 5 months ago

Also having this issue. I tried updating to the Pre-Release Version and reloading but it still persists. I stumbled across this thread because I wonder if this is causing Go to Definition from working.

Screenshot 2023-12-04 at 10 20 47 AM

Gatoloko44 commented 5 months ago

That's very strange on my computer it works fine but i don't know why in yours doesn't works

vinistock commented 5 months ago

I made a release reverting that change while we understand the problem better.

andyw8 commented 5 months ago

I'm not too familiar with Windows, but a post here says the Disk Cleanup tool may delete those files. Could something have triggered that to run?

akirataguchi115 commented 5 months ago

I just installed Ruby fresh on Windows 11 yesterday and didn't manage to use Disk Cleanup in that short period before that error popped for me.

akirataguchi115 commented 5 months ago

Version v0.4.22 has fixed it for me at least for now. Does updating work for you @Gatoloko44 ?

SaidRasinlic commented 5 months ago

This is most definitely because of Shopify/vscode-ruby-lsp#918, but I don't understand why it's happening. That PR started using a temporary file to write the Ruby environment activation because some shell configurations take over STDERR and caused issues.

For some reason, writing the temporary file is failing. Either that or it is somehow being deleted before we read it. Trying to figure out why that's happening...

I opened tmp files and observed what's happening when I open VSCode, and it seems like it creates folders (related to the Ruby LSP extension) and then they immediately get deleted automatically (I had to record to catch that).

Here is a video (reduced video quality so it can fit <10MB) of what's happening when I open VSCode, and as you can see on 0:05, it creates 3 folders, and they immediately get deleted, and then that Ruby LSP error pops out (Failed to activate...)

https://github.com/Shopify/vscode-ruby-lsp/assets/57558480/5ee299f0-c7d4-4d3b-ab62-dad0d47697f0

ruby-lsp-tmp

Gatoloko44 commented 5 months ago

Version v0.4.22 has fixed it for me at least for now. Does updating work for you @Gatoloko44 ?

Yes it worked for me

vinistock commented 5 months ago

@SaidRasinlic thank you for sharing that video, it helps better understand the problem. It looks like writing to the temporary file succeeds, but then it gets immediately removed (possibly by antivirus software?).

In that case, we won't be able to fix problems like Shopify/ruby-lsp#1712 (where the STDERR pipe is hijacked by a shell plugin) until Shopify/vscode-ruby-lsp#923 is finished and shipped (which decouples the extension from the shell).

I'll close this issue for now since we reverted the PR that caused trouble.