You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to jump to the definition of a function or a trait defined with the #[generate_trait] macro the language server fails and outputs unable to convert URI to filepath: vfs://201/generate_trait.cairo
Expected behavior:
It shouldn't fail and jump to the definition.
Steps to reproduce:
Related code:
use bar::{A,DummyTrait};fnmain(){let a = A{b:1};
a.dummy()}mod bar {#[derive(Drop)]structA{b:u8}#[generate_trait]implDummy of DummyTrait{fndummy(self:A){}}}
Now when trying to jump to the definition of a.dummy() or DummyTrait it fails
Other information:
Proposed solution
Drop the vfs:// scheme and write virtual files to a temporary directory just for presentation purposes instead. All of this should happen entirely within CairoLS without modifying Cairo compiler codebase.
The text was updated successfully, but these errors were encountered:
Note that this issue only happens on non-VS-Code editors (e.g. Helix) but not VS Code. I originally thought that this is a universal problem, and thus submitted helix-editor/helix#6000 to Helix to ignore vfs URLs altogether. However, @LucasLvy reminded me that it works in VS Code so I took a look and it does indeed work. Good news right? Not really...
Upon further debugging, it turns out that the Cairo LSP defines a custom method vfs_provide:
So... basically the Cairo LSP is proprietary... Any other editors that expect a compliant LSP wouldn't work 100% with the Cairo LSP.
IMO, the ideal way to handle ephemeral files is to simply use a directory like target to actually generate the file and serve the actual path (instead of vfs) to clients.
Instead of employing a custom vfs/provide method, CairoLS should lazily emit virtual files as temporary files in /tmp (follow platform conventions). These files should only be written whenever an URL for them is being generated. Implementor should pay great attention that unused files are deleted by OS (for example on system shutdown).
@0xLucqs commented on 30.08.2023, 12:24:07:
The text was updated successfully, but these errors were encountered: