vscode-shader icon indicating copy to clipboard operation
vscode-shader copied to clipboard

Extension does not go to definition when it is in a different file

Open Skylark13 opened this issue 1 year ago • 1 comments

Hello,

Thanks for this extension! Given issue #70 I don't know what kind of support I can expect but let's try anyways :)

When I have function calls in the shader I'm currently viewing, and I press F12 to go to definition, it works if the function is in the same file, but not if it was included in a header.

Context: Our project uses HLSL, and main files (shader entry points) have the *.hlsl extension but included files (containing shared code) have the *.hsh extension. I already had the following in my vscode settings so that HLSL syntax highlighting worked in *.hsh files:

    "files.associations": {
        "*.hsh": "hlsl"
    },

and syntax highlighting does work, but go to definition still doesn't work when the definition is in one of those files.

The files are always included using relative paths (something like #include "../Algorithms/ColorConversion.hsh" if the current file is in a folder parallel to the Algorithms folder) and that all works as far as compilation is concerned.

So I'm not sure what the issue could be. I might be able to debug this myself (if getting set up to run the extension with local code is not too involved). But if anyone else has an idea I'd be interested.

Thanks in advance.

VSCode version: 1.91.0 Extension version: v1.1.5

Skylark13 avatar Jul 04 '24 18:07 Skylark13

What feels like years later, I am finally getting back to this.

From what I can see, provideDocumentSymbols gets called but provideWorkspaceSymbols never gets called, and this is the function that looks at includes (from what I understand). I have no experience developing/debugging vscode extensions so I have no idea why that is.

And it is not because of the early return at the start of the function (though that tripped me up at first) -- I had a warning that vscode-ripgrep could not be found, but I changed the code to check in the new location (see https://github.com/stef-levesque/vscode-shader/issues/56) and now it's found but the function still doesn't get called.

    rgPath = exePathIsDefined( Path.join( vscode.env.appRoot, "node_modules/vscode-ripgrep/bin/", exeName() ) );
    if( rgPath ) {
        return rgPath;
    }

+    rgPath = exePathIsDefined( Path.join( vscode.env.appRoot, "node_modules/@vscode/ripgrep/bin/", exeName() ) );
+    if( rgPath ) {
+        return rgPath;
+    }

I know this extension is looking for a maintainer, but if anyone has a suggestion of why provideWorkspaceSymbols never gets called, I'm kind of stumped.

Thanks!

Skylark13 avatar Nov 29 '24 14:11 Skylark13