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

lsp: include all modules in language server scope for a enabled folder automatically #11190

Closed
SteelAlloy opened this issue Jun 30, 2021 · 6 comments · Fixed by #17979
Closed
Labels
feat new feature (which has been agreed to/accepted) lsp related to the language server

Comments

@SteelAlloy
Copy link

test

Describe the bug

When using Go to references, the extension doesn't find references in files that are not opened in the editor.

To Reproduce

// a.ts
export const a = 0;
// b.ts
import { a } from "./a.ts";
// c.ts
import { a } from "./a.ts";

Open a.ts and b.ts, go to references of a. No references in c.ts.

Expected behavior

c.ts should appear in the panel.
This makes this feature useless if you have to open every file in your project to find references

Screenshots

reference

Versions

vscode: 1.57.1 deno: 1.11.3 extension: 3.6.1

@kitsonk kitsonk transferred this issue from denoland/vscode_deno Jun 30, 2021
@kitsonk kitsonk changed the title "Go to references" only works with open files lsp: "Go to references" only works with open files Jun 30, 2021
@kitsonk kitsonk added lsp related to the language server suggestion suggestions for new features (yet to be agreed) labels Jun 30, 2021
@kitsonk
Copy link
Contributor

kitsonk commented Jun 30, 2021

Current we do not analyse files that aren't dependencies of opened files that are unopened. For tsc you can specify "files" or "include" but Deno doesn't work that way, as you supply a "root" module on the command line. Since we don't have that concept in an editor at the moment, we treat every file when opened as a "root" file.

An enhancement which might be worth considering is allowing the roots to be specified in the config. Which means that we would always include it and its dependencies irrespective of what files were open.

@bxantus
Copy link

bxantus commented Aug 23, 2021

In my opinion the whole workspace should be scanned, at least it should be an option.
You can have multiple "root" modules in a solution (like having a debug/release or any other kind of configuration), and usually you are interested in all usages, not just the ones from one "root" module.

(I created an issue in the vscode extension repo, which is closed as a duplicate. I would implement this functionality in the extension, built on top of the facilities which are provided by the lsp. The lsp should support only the discovery of file dependencies, to avoid duplicate searches from the extension)

@kidonng
Copy link
Contributor

kidonng commented Jul 2, 2022

In my opinion this is a showstopper for serious development using Deno. One has to either consult plain old editor search, or remember to open all files including the symbol, which is impossible for any reasonably large project, or a (open source) project you are not familiar with.

@kitsonk kitsonk self-assigned this Jul 4, 2022
@kitsonk kitsonk added feat new feature (which has been agreed to/accepted) and removed suggestion suggestions for new features (yet to be agreed) labels Jul 7, 2022
@kitsonk kitsonk changed the title lsp: "Go to references" only works with open files lsp: include all modules in language server scope for a enabled folder automatically Jul 7, 2022
@itsMapleLeaf
Copy link

itsMapleLeaf commented Jan 13, 2023

Just mentioning that this (and related issues around Go to references and auto-import) is still one of the bigger holdbacks from using Deno in a serious project

@bartlomieju
Copy link
Member

Discussed this with @dsherret this week. We have an idea how to fix this problem. We'll update the issue with description of necessary steps in a couple days.

@aapoalas
Copy link
Collaborator

Partially related to #17663 which intends to add a --side-module(s?) / --import(s?) / --module(s?) flag to enable multiple roots in the Deno module graph.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat new feature (which has been agreed to/accepted) lsp related to the language server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants