-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Improve "suggestions show path" for "node_modules" #42005
Comments
That string was never meant to be shown to humans—at this stage, we don’t know that I think it would be an easy win to drop the leading But, TypeScript needs that string to contain |
This issue has been marked as 'External' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
This issue has been marked as 'External' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
I’ve been experimenting with different ways we can do this while minimizing the interactive response time for completions. The options we have can be broadly divided into two buckets: ones where the response is complete and ones where it is incomplete. CompleteA complete response means that, like today, we generate the full list of completions when they’re requested, that list is filtered down by the client, and the client never asks for an update to that list; it only asks for additional details for single items as they’re focused. The only way we can significantly improve (uncached) performance for complete responses is to limit the number of auto-imports that show module specifiers (most simply by limiting the number of auto-imports even included in the list). Note: all response times reported are with completely cold caches. Subsequent requests, especially in the same file, are faster.
These strategies are extremely easy to implement and minimize number of requests and message size of requests, which could be something to think about for remote scenarios, but is usually not one of our biggest considerations. They also feel the snappiest after the response comes back since additional typing only results in client-side filtering. IncompleteIncomplete responses, by contrast, result in the client re-requesting completions after more typing occurs. The idea is that we could resolve module specifiers only for the top N auto-imports, and if there are more without resolved module specifiers, we mark the response as incomplete. Then, when the user continues typing, we get another request. At this point, we have more identifier characters to filter by, and we can pull the previous response out of a short-term MRU cache, so we could fill in another N module specifiers for items that match the typed identifier until the response is fully filled in with module specifiers. I tried a very quick, simple demo of this, and it seemed to work pretty well. The advantage of this general approach is that we would be able to offer all auto-imports that are offered today, and show module specifiers for them once enough characters have been typed that the list is sufficiently small, and we could do this for near-zero performance impact on the time it takes for the list to appear. The disadvantages are higher complexity, much higher cumulative TS Server traffic and response time, and the fact that someone simply scrolling the initial list with incomplete items would see an inconsistency between the ones at the top that have resolved module specifiers and the ones at the bottom that don’t. |
I should also clarify that I outlined only the options that are available to us now with minimal or no API/client changes. The third way would be to request pages of |
Yes - we have currently no plans to lazy load labels of completion items. |
Search Terms
TypeScript suggestions show path
TypeScript can provide completions that also add an import statement. However, when there are multiple symbols with the same name, it is hard to pick the right completion. This release makes this simpler because paths of auto-import completions are shown with the label.
Suggestion
As description above. I think the path should be show as
import
form, not show path like 'node_modules/xxx/index' but 'xxx'And sort it as the "show fixes" menu I post below.
Use Cases
Here is the current result
It is not very easy to choose which one to import
Table
, because the path is too long and very same. (Actually I want the 3rd one, it is 'antd')Here is the "show fixes" menu
It is much more clear.
Here is the "show fixes" menu, when I already import something from 'antd'
Examples
no example.
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: