Skip to content

TSServer: navto command should be supported without a file #2530

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

Closed
dbaeumer opened this issue Mar 27, 2015 · 13 comments · Fixed by #38027
Closed

TSServer: navto command should be supported without a file #2530

dbaeumer opened this issue Mar 27, 2015 · 13 comments · Fixed by #38027
Assignees
Labels
API Relates to the public API for TypeScript Committed The team has roadmapped this issue Domain: TSServer Issues related to the TSServer Fix Available A PR has been opened for this issue Suggestion An idea for TypeScript VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone VS Code Tracked There is a VS Code equivalent to this issue

Comments

@dbaeumer
Copy link
Member

Currently the file is only used to detect the virtual project. Now that we have tsconfig.json support we can use the language service bound to a tsconfig.json file to find navto items. I would propose the following handling in case of the absense of a file:

  • no tsconfig project. Command return no content message
  • all projects are tsconfig project: return the nav to items (filter duplicates)
  • there is a mix: the response contains a flag indicating that the result might be incomplete.
@danquirk danquirk added Suggestion An idea for TypeScript API Relates to the public API for TypeScript labels Mar 27, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Mar 27, 2015

I find it strange that you would get results from all projects even if you have a file open which points you to a single project. Can you explain the scenario you want to enable?

I think we have a related issue (#2531), if that fixed, given a file you would be getting all results from related projects, but not unrelated. would that satisfy your scenario?

@dbaeumer
Copy link
Member Author

If I think about a workspace with n components I would have a tsconfig.json file per component. Now if I want to navigate in that workspace I would like to see a list of all navto items accross all components. For me that is comparable to a VS solution having n projects where project === tsconfig.json

@dbaeumer
Copy link
Member Author

So to answer your question: no.

I would still like to see a mode where I can see all items.

@mhegazy
Copy link
Contributor

mhegazy commented Mar 30, 2015

mmm. this is interesting, i think this is the a good scenario to support; but how would you make this not noisy in the general case? imagine a few files open, each with a few .d.ts files, now you get navigate to results, and you get a lot of results that may or may not be what you are looking for.

@steveluc
Copy link
Contributor

I think the only way to make this not confusing is to have some way of expressing project relationships. So far we have chosen not to do this, leaving that level of specification to project systems such as grunt and gulp.

I agree with Mohamed this is a good scenario and we should support it in some way. We could have two different commands in Sublime, one that just searches through every open project and one that searches only the projects that include the current file. This could be supported in the protocol, as Dirk suggests, by making the file optional.

Either way, I think this would be more helpful and less confusing if we implement a way to explore the set of currently active projects, as Mohamed has previously suggested.

Steve

From: Mohamed Hegazy [mailto:[email protected]]
Sent: Monday, March 30, 2015 11:02 AM
To: Microsoft/TypeScript
Subject: Re: [TypeScript] TSServer: navto command should be supported without a file (#2530)

mmm. this is interesting, i think this is the a good scenario to support; but how would you make this not noisy in the general case? imagine a few files open, each with a few .d.ts files, now you get navigate to results, and you get a lot of results that may or may not be what you are looking for.


Reply to this email directly or view it on GitHubhttps://github.com//issues/2530#issuecomment-87774495.

@dbaeumer
Copy link
Member Author

I gave it some more thoughts and simply providing no file will not do the trick. It will force the TS service to search for all tsconfig.json files and open them. And that might not be what the user wants.

So if a workspace has more than one tsconfig.json file I think we need something like a tsglobal.json file which describes the valid tsconfig.json files and there dependencies. The TS service could then open the tsglobal.json file and act appropriately.

And I like the idea of being able to explore the set of active projects. It would help the user to understand the behavior of some global actions better.

@mhegazy mhegazy added the Help Wanted You can do this label Dec 9, 2015
@mhegazy mhegazy added the VS Code Tracked There is a VS Code equivalent to this issue label Dec 16, 2016
@mhegazy mhegazy added this to the Community milestone Jan 4, 2018
@RyanCavanaugh RyanCavanaugh modified the milestones: Community, Backlog Mar 7, 2019
@mjbvz mjbvz added the VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone label Oct 24, 2019
@DanielRosenwasser
Copy link
Member

There seems to be some context we've lost in the history of this discussion. Can we get some clarity on the file that we're discussing? What is the scenario and the specific operation that's occurring?

@DanielRosenwasser DanielRosenwasser added the Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. label Jan 24, 2020
@dbaeumer
Copy link
Member Author

If I remember correctly this is about workspace symbols which always needs a file input as well. If you have a workspace with n projects this never allowed you to list all symbols from all projects. But I have no idea if this is still true :-)

@RyanCavanaugh RyanCavanaugh added this to the TypeScript 3.9.0 milestone Jan 29, 2020
@mjbvz mjbvz added Committed The team has roadmapped this issue and removed Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. Help Wanted You can do this labels Feb 5, 2020
@DanielRosenwasser DanielRosenwasser added Help Wanted You can do this Domain: TSServer Issues related to the TSServer Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". and removed Effort: Difficult Good luck. labels Feb 27, 2020
@bpasero
Copy link
Member

bpasero commented Mar 17, 2020

Please fix this 👍

@sandersn
Copy link
Member

So: navto needs to have an option to find symbols across all projects, as defined by project references? Or is there something additional needed?

I don't know the navto code or the project references code, so I don't have an idea yet of how hard this will be.

@dbaeumer
Copy link
Member Author

Yes that is correct.

@sandersn
Copy link
Member

Looking at this, it seems that navto currently returns symbols from the current file's project and any dependencies. But it doesn't return symbols from dependent projects. That is for projects Base -> Derived, in Base, you only get Base's symbols, but in Derived, you get the symbols of both.

If all the symbols are already available and are being filtered by file, then it might not be to skip the filtering and return all of them. I'll go find the navto implementation and see.

@sandersn
Copy link
Member

Development is happening on the branch navto-covers-all-projects. It's pretty hacky right now, and extremely slow on Typescript itself.

(Note that I'm using emacs, which makes a synchronous call to get the navto list, so it's probably better in Code.)

@sandersn sandersn added Fix Available A PR has been opened for this issue and removed Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Help Wanted You can do this labels Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Relates to the public API for TypeScript Committed The team has roadmapped this issue Domain: TSServer Issues related to the TSServer Fix Available A PR has been opened for this issue Suggestion An idea for TypeScript VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants