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

[tsserver] Support for "Search Types" #8265

Closed
angelozerr opened this issue Apr 23, 2016 · 10 comments
Closed

[tsserver] Support for "Search Types" #8265

angelozerr opened this issue Apr 23, 2016 · 10 comments
Labels
API Relates to the public API for TypeScript Question An issue which isn't directly actionable in code

Comments

@angelozerr
Copy link

angelozerr commented Apr 23, 2016

It should be very cool if tsserver could provide a new command "findAllTypes" which gives the capability to search types coming from ts files of the project.

To explain more my idea, I would like to implement inside typescript.java (Eclipse plugin for TypeScript) the same feature than we have with Java inside Eclipse.

See the following screenshot:

javaopentype

In this sample we have several classes MyServiceA, MyServiceB and an inner class MyInnerServiceA in a Java project. We can open a dialog "Open Type" to search any types in the Java Project with a filter. It's very helpful when you wish to go at a definition of class but you don't know which files defines the class (in Java world, Java class name follow the same name than the file, but in TypeScript world, you can defines any classes in any files).

@angelozerr angelozerr changed the title [tsserver] Support for "findAllTypes" new command [tsserver] Support for "Search Types" Apr 23, 2016
@basarat
Copy link
Contributor

basarat commented Apr 24, 2016

I used the language service modifying the get navigation items API endpoint to achieve a similar "Symbol Search" in alm tools : https://basarat.gitbooks.io/alm/content/features/omni-search.html#symbol-search

@angelozerr
Copy link
Author

angelozerr commented Apr 24, 2016

@basarat very cool integration about search types. Hope tsserver will provide this command too.

Do you use some index features to have well performance? TypEcs provide this same feature: to do that it creates a DB with the whole ts files to store Types. After that performance are very good.

@drake7707
Copy link

drake7707 commented Apr 24, 2016

I use the getNavigationBarItems() method to build a treeview which I can filter (see http://drake7707.github.io/Typescript-Editor/). Though this probably becomes a hassle (and not very efficient) if you have to call it for each ts file.

@angelozerr
Copy link
Author

@drake7707 in my case I use too "navbar" tsserver command to fill outline. But it's only for a given file. My idea is to search types from the whole ts files of the project.

I think searching types from the whole ts files of the project can be interested for other issues like #7849

@mhegazy
Copy link
Contributor

mhegazy commented Apr 28, 2016

use NavigateTo instead of navbar (command: "navto"). this gives you all the names given a prefix. see https://github.com/Microsoft/TypeScript/blob/master/src/server/protocol.d.ts#L1066.

you can then filter on the kind, and keep the types, and remove the variables if you so choose.

@mhegazy mhegazy added API Relates to the public API for TypeScript Question An issue which isn't directly actionable in code labels Apr 28, 2016
@angelozerr
Copy link
Author

@mhegcazy many thanks for your suggestion.

I will try "navto" command, but if I understand your suggestion it means that it searchs in the whole of ts files of the project?

But I'm a little afraid with performance if I cannot filter on tsserver side type, because with large project, there are a lot of variables, etc although in my case I need just type.

@mhegazy
Copy link
Contributor

mhegazy commented May 3, 2016

But I'm a little afraid with performance if I cannot filter on tsserver side type, because with large project, there are a lot of variables, etc although in my case I need just type.

The server does filtering on the production side limiting to the searchValue. do not expect you have that many entries with the same name but different kinds.

@mhegazy mhegazy closed this as completed May 3, 2016
@angelozerr
Copy link
Author

angelozerr commented May 3, 2016

@mhegazy why do you close this issue?

I think a robust search types with complex criteria should be very usefull:

But perhaps you find those features are too specific so we could do that in the future with a plugin once #6508 will be implemented.

@mhegazy
Copy link
Contributor

mhegazy commented May 3, 2016

if I type '*' I would like to have the whole types.

we used to do this in the past. the size of the result was large that it caused perf issues both on th eserver and on the client serializing the result.

I would like to search types which implement some interfaces to support #8268

And #8268 is tracking it. it is marked as suggestion and is open. do not think we need two issues for that.
If you would like to generalize that proposal, feel free to update #8268

support auto import #7849 and we could have an other service typedetail (like completionDetails) which gives the import to add.

This is a quick fix, not a search. we should be looking into these in TS 2.1

@angelozerr
Copy link
Author

Many Thanks @mhegazy for having taken time to give me your great answer! Very exciting with TS 2.1 :)

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API Relates to the public API for TypeScript Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

4 participants