-
Notifications
You must be signed in to change notification settings - Fork 0
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
not well motivated by IDE support #1
Comments
That still causes left to right typing issues and collides with tab completion on RHS of that position which now is looking to be populated by module attributes. I agree things can be configured in various ways, but quick searches of social media do show programmers having problems with this. We shouldn't disregard all those who have issues, nor should we disregard the collision with future syntax possibilities. If a solution can be well propagated I think it would have done so by now. Even popular editors don't support this syntax in the way mentioned above out of the box. |
@michaelficarra to clarify, if people are consistently requesting this and tooling does not support this consistently/by default due to various reasons would gathering a listing reasons tools do not do the proposed workaround workflow be enough to provide evidence of motivation for you? |
If tools are opting to not do the workflow described by @jridgewell, hearing the reasons they don't could make me understand the motivation better, yes. |
@michaelficarra I've opened up #2 to see if any tool does do that workflow and #3 to gather comments about issues people are having. I will try and figure out how to directly sort responses from editors, but that is likely a difficult communication channel to establish. |
Apparently VS Code has the ability to define snippets in the way @jridgewell describes. From @rauschma: https://twitter.com/rauschma/status/1221131422641070081 |
@michaelficarra they autocomplete only after you populate the RHS, which is somewhat the issue at hand. // -> ltr typing
import {} from 'lib'|
// <- rewind to useful position
import {|} from 'lib'
// -> forward to useful position
import {} from 'lib'| and // no useful completions
// there is a builtin snippet for vscode here but not by default completion
// snippet replays workflow and rewind/forward as above
import | vs // -> continuous ltr typing
from 'lib' import | |
(note, I don't currently use an IDE so I'm not getting auto-completion anyways…) When using snippets, I've never been bothered by the backwards jumping with tab completion. I just hit tab and it goes directly to where I wanted. |
There has been some discussion in the typescript team about using your package.json to see all the exports available, then filtering them down inside the |
The TL;DR of the TypeScript discussion @jasonwilliams just linked is that we would like to be able to offer useful completions for a whole import statement at It’s still a feature we’re looking at, but it has proven more difficult than we initially thought it would be, and I’m not yet confident we can always provide a great UX here. |
@andrewbranch can we summarize that to the current syntax being problematic? It seems like this would be an issue with this proposal too if someone wrote |
I guess that would be problematic, but I think the idea is that users generally wouldn’t write that. I’m assuming the syntax order will have some positive correlation with the order that most users incrementally write out an import statement, and it is much easier for us to give useful completions for exported identifiers when we already know the module specifier. I think in a hypothetical world where |
Hey everyone, I've been doing what @jridgewell describes for a few years now. Following a discussion with @bmeck on Twitter, I realized that while this is possible with an my IDE and some config, most people struggle with this and most IDEs don't provide a default and simple way to do this. So I agree this proposal would benefit most users in a standard way. In the mean time, and because I think a video demo is better than a description, here's what I have with WebStorm and a custom "live template" (it's how they call snippets). 2021-05-14.17-39-05.mp4Details
I had to create this live template in the settings like this: And I had to reorder the parts like this so it focuses in the right order: Cheers 😉 |
As an update, TypeScript 4.3 is shipping with the feature mentioned earlier by @jasonwilliams. https://devblogs.microsoft.com/typescript/announcing-typescript-4-3-rc/#import-statement-completions |
The claimed motivation for this proposal is IDE support, but IDEs already have solutions for exactly this stated problem. @jridgewell has explained it very well over on TC39 Discourse.
The text was updated successfully, but these errors were encountered: