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

VSCODE "references" above the javascript functions include only the current file? #12534

Closed
JimNayzium opened this issue Aug 1, 2024 · 4 comments

Comments

@JimNayzium
Copy link

Describe the problem

I am used to using DevSense for PHP with vscode and when I click the references over functions with that tool, it shows every reference workspace wide.

When I see the references above svelekit javascript functions, they only represent the references on that give file, or in that given class on the page.

Am I missing something?

Describe the proposed solution

I propose that references over the javascript function names when clicked would show every reference like the DevSense PHP plugin.

Alternatives considered

I have searched for extensions and not found the right combination yet.

Importance

nice to have

Additional Information

No response

@Conduitry
Copy link
Member

Have you installed the official Svelte extension for VSCode? I have no idea what a PHP extension would do with .js or .svelte files.

@jasonlyu123
Copy link
Member

Are you referring to the reference codelens? I am guessing you don't have a tsconfig/jsconfig.json. If you don't have it only the open documents are considered. The language service also won't understand SvelteKit's $lib alias, see #12249.

You can try creating one following the create-svelte template. https://github.com/sveltejs/kit/blob/main/packages/create-svelte/shared/%2Bcheckjs/jsconfig.json. You can remove the checkJs option if you don't want TypeScript to type-check your js files.

@JimNayzium
Copy link
Author

This feels super helpful as I read it!! Thanks for all the information.

  1. I am not in typescript at all, so I don't think I have a useful tsconfig of any kind. I thought i had a jsonfig.json in an earlier project that I started from, but I just looked and I do not!! So that gives me hope!
  2. I will read up on $lib alias, which is all over my code! Is that a dead-end? Shoudl I convert them all from $lib to the full path? (I will read up on it.)
  3. I will try creating one and see what happens!! THANKS so much.

As for Php dealing with .js or .svelte, I misscommunicated. I was saying in my laravel project, when I am in PHP the PHPDevSense is incredible and does so much like these accurate references and other great things I have gotten used to using, but now that I am in sveltekit (which I LOVE) I've lost some of that funcitonality I got really used using! Thats' all I meant.

And yes, I am referring I think to the codelens tools.

Thanks y'all.

@JimNayzium
Copy link
Author

Are you referring to the reference codelens? I am guessing you don't have a tsconfig/jsconfig.json. If you don't have it only the open documents are considered. The language service also won't understand SvelteKit's $lib alias, see #12249.

You can try creating one following the create-svelte template. https://github.com/sveltejs/kit/blob/main/packages/create-svelte/shared/%2Bcheckjs/jsconfig.json. You can remove the checkJs option if you don't want TypeScript to type-check your js files.

This completely solved my issue. I guess I didnt' check the correct options on this installation as I had a handful of jsconfig.json files in other projects to pull from, and also read the github you linked here and it worked like a charm. Even to the minutia detail of it red underlining all my .js parameters and then I made checkJs false like you explained so typescript would not red-mark up my code!

Thanks so much for the great feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants