vscode-code-outline icon indicating copy to clipboard operation
vscode-code-outline copied to clipboard

Feature Request: Detect and fold Import Statements

Open MartinHaeusler opened this issue 8 years ago • 4 comments

Really nice add-on, the first of its kind that really works for me! Has the potential to be a major game changer for VSCode in my opinion.

One thing that I would like to see is a smart detection of import statements for JavaScript and TypeScript files. Those statements should receive a different icon than, say, a constant, should be grouped together in a single tree node and folded by default.

I do realize that this will be a lot more difficult for JavaScript and Typescript than other languages (like Java), because imports can theoretically appear in any place in the file, and distinguishing an import from a constant declaration based on the AST could be difficult. But this would really be a great feature.

MartinHaeusler avatar Jun 13 '17 17:06 MartinHaeusler

This would be nice to have but to do it properly I will need VSCode to know that a symbol comes from an import. I'll open an issue there.

patrys avatar Jun 13 '17 17:06 patrys

Related: https://github.com/Microsoft/vscode/issues/28649

patrys avatar Jun 13 '17 17:06 patrys

The upstream issue was closed because they aren't planning to do it in the next 6-12 months. Sad face.

stacktracer avatar Apr 18 '18 12:04 stacktracer

There is still hope as the new folding provider API (currently in preview so not usable yet) lists "imports" as one of the folding region kinds.

patrys avatar Apr 18 '18 12:04 patrys