-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
"Open Symbol By Name" is not working properly in multipy typescript projects. #8081
Comments
We do only build projects for opened files in tsserver. However, after you commenting of the What is the setup of your other project which only ".d.ts" symbols can be searched? We recently added test infrastructure for the project system, this should be able to help us eliminate problems. |
In addition, the order in which the files are opened matters by design. When one file belongs to multiple projects, we try to resolve the conflict by determining which types of project has a higher priority. But sometimes there are no ways to know which one the file is "intended" to belong to. So in cases like these, it goes to the first project created. |
@zhengbli
Then I tried several times, each time I close all working files and restart vscode.
|
When "bfunc" can't be found, even I opened "b.ts", it still can't be found. |
Thanks for the detailed repro procedure! Indeed I see this on my machine too. I'll dig deeper tomorrow, it could be either the project system or the navBar APIs. |
If I don't open the project entry ts files, tsserver will not known "all files" in the project. And can't implment a reasonable "Open Symbol By Name".For exmaple, if I close all files,and create a new ts file in the project. Then no symbol will found. It looks not good. Will tsserver search all tsconfig.json to build projects? I think this is the right way. |
Indeed this is not ideal for features like "Go to anything" in sublime. We are working on supporting the "Open Project" api, which will keep the project alive regardless of the opening files, though it will likely land after 2.0 release. Actively searching for all tsconfig.json by default can be resource-intensive, because for each project we have to open all the files and watch the files and directories etc, we want to be efficient about the resource allocation. Currently in most cases users open the editor at one project root, so it may not be worth it to eagerly build everything by default. Though we can think about adding configuration to enable such scenarios if the user really wants to. This also align to the suggestion we had about extend our definition of projects on tsserver to support "mid-sized" scenarios (microsoft/TypeScript#3469). |
So I took a further look of the request / response records, and it seems that VSCode is not sending the correct file name for the [open a/main.ts, and try to search the
This is the correct behavior. [Then open b/main.ts, and try to search the
This doesn't seem right, as the |
@zhengbli thanks. I will have a look. |
I fix this by taking the active document as the context. However TS still doesn't provide a global workspace search. The search is always limited to a TS project. |
Opened #11026 to see if we can fake this. |
Steps to Reproduce:
For exmaple:
open "c.ts" and insert:
Then you can search symbols in "b.ts". Then comment it, and if symbols in "b.ts" can be searched is undetermined, sometime can and sometime can't.
And in my another project, only symbols in ".d.ts" can be searched.
And another problem is I can't search variable names in global scope, even I export it.
The text was updated successfully, but these errors were encountered: