-
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
Please provide autocomplete for <reference> and import paths #188
Comments
👍 |
@NoelAbrahams btw resharper will do that for you : |
@basarat, interesting. Never used resharper and don't think that's going to change. So for anti-third party tool people like myself I hope this will go into the VS plugin. 😄 |
👍 |
@NoelAbrahams btw atom-typescript will complete your references : https://github.com/TypeStrong/atom-typescript#relative-paths and even autocomplete external module "name" and "./path"s 🌹 |
I don't know whether @ahmad-farid has actually gotten the chance to start on this, but @basarat, is this functionality something you think you could potentially contribute to TypeScript itself, or is it more tightly coupled to atom-typescript? |
Tightly coupled in that I do poor tokenization to detect these : The code to get these results is a bit simpler
Doesn't have to be tightly coupled. But that's just how I wrote it as a TypeScript consumer and there can't be a copy paste PR. If someone were to PR this they would do the am I in a reference comment/import string? detection on Also more possible hoops : #2173 (comment) |
Can you not drag and drop for that seems far easier. for import autocomplete I would suggest having another feature like "Copy Import Reference" in solution explorer right click on file and then paste this in file which would write like 'import fileName = require("../dir/filename");'. This should keep track of relative paths and file name casing. if someone can guide me where should I look for it in this source, I can try to add on. |
The Visual Studio related code you would need to modify to make changes like this aren't open source at the moment. We actually had drag and drop /// reference generation at some point but it's highly undiscoverable and doesn't scale very well (do you really want to drag and drop 5+ items from disparate parts of your solution in folders that may be closed in solution explorer?). In any case, those sorts of interactions would be nice but it should also be easier to do in a keyboard focused workflow which autocomplete would help with. |
we have so many modules that walking the filesystem is not practical, and some of them are generated external module names, not files. So we would like to run a periodic indexing, and then somehow provide a list of these to the language services (eg. an RPC, or a file we stage on local disk, etc.) |
+1 having auto-complete on import will be awesome. |
Still seeing a lot of requests for this, especially as now with VSCode and Salsa this is effectively a regression (i.e. they used to give completions on |
any news on this ? |
working on it. but nothing to report. |
Has there been agreement how this should work for imports? I imagine this would be a nice user experience: in VS Code if I hit Ctrl+T (Type to search symbols project wide), and choose a symbol it would allow me to somehow generate import statement for it. Tiny bit related, some reason the project wide symbol listing does not show me exported variables, e.g. |
@Ciantic That sounds good. I would rather have it when using Intellisense it automatically imports things that it autocompletes that aren't in scope. I would also like the option to clean up unused imports or either further functionality for sorting them. Another thing that would be nice is something like if you delete the last usage of something imported, the import statement gets removed. |
I built this to stopgap the problem for myself https://marketplace.visualstudio.com/items?itemName=Sammons.ts-import-assistance, code is here: https://github.com/Sammons/ts-import-assistance. It is not super intelligent but it does what I need. Essentially I found no easy way to see which symbols were missing in the current document - so this is a command you can execute to search for and import the symbol you have highlighted. This just builds on top of the built in symbol search. |
I also came across and used this VS Code Plugin to help in the meantime: It helped tremendously when I was switching a project from namespaces (internal modules) to external modules. |
@Taytay Thanks, tried it, but it's causing my VS Code to hang.. Maybe my app is too big, but it's useless to me. |
Oh dang @rolandoldengarm. Understood. (For what it's worth, I've found the author to be responsive in issues in case you want to pursue it.) |
@Taytay Thanks for the info, but I made my own extension ;-) currently I'm rewriting the logic to make it faster. I'm not using regex to parse through the files (like many others do), but use the typescript compiler to generate the AST of the source. |
@buehler This works great! Had no problems as yet. Definitely much faster than typing it all out. |
please what is the status of it? roadmap has it checked, but the nightly build doesn't show it |
how are you using the nightly build? |
@mhegazy i am using VSCode with the
in the there is no autocomplete for the module paths for imports as you can see the autocomplete only shows an already seen text token not a name of a file on disc |
It works with relative paths, but not with "absolute paths" (combination of baseUrl and paths). |
Hi,
Visual Studio (2013 Ultimate) provides intellisense for the src attribute for script elements, by reading the file system and displaying available files or folders.
It will be quite useful if similar functionality can be provided for
<reference>
and import statements:The text was updated successfully, but these errors were encountered: