MarioCadenas / vscode-alias-resolver

VSCode extension to resolve alias configurations
https://marketplace.visualstudio.com/items?itemName=mariocadenas.alias-resolver
3 stars 0 forks source link

Vue file extension support #26

Open EranGrin opened 3 years ago

EranGrin commented 3 years ago

Great work!

I had a similar idea to create an extension to resolve the webpack alias (same as PhpStorm) but luckily, I did a quick check for an existing extension and stumbled upon yours.

The only thing I'm missing is support for vue files *.vue. Would be great if you could add this support but otherwise if you don’t have time I could also start debugging the issue and add a PR. Thanks, πŸ™

MarioCadenas commented 3 years ago

Hi @EranGrin Thank you for opening, I have a few things that I want to do to this extension but I don't have a lot of time lately. If you think you can open a PR to contribute, is more than welcome. Luckily I might be able to look into it this weekend. Could you please give me a bit more of a detailed explanation of the use case you are looking for? Just being able to make this work on *.vue. files?

Thanks!

EranGrin commented 3 years ago

Hi @MarioCadenas, thanks for the prompt response. I did open the code and run it in the vsCode debugger, but I couldn't find the issue at first glance or any property that define the file type to be only js, I assume it is related to the fact that vsCode nativity doesn't support .vue files. The use case(for me) is only to add support for .vue files. But.... if you're already taking this millstone I guess it might be nice to make this Great Plugin also support other frameworks: Angular, React etc..

If you do have time to check it that would be brilliant, otherwise I would have to slowly dive in to it and make a PR Thanks again.

zardoy commented 2 years ago

How it can be implemented: https://github.com/zardoy/vscode-extension-patches/blob/e5110259bf2634a322b488ea7cf4c1d4b5b19254/extended-extensions/extensions/volar/all-features.patch#L1540-L1700 (I understand it might be hard to read) in my case it works just ideally

You can use it today with this extension in takeover mode in any projects. I can make pr to backport this native solution.

@MarioCadenas if you still care of this extension I think it should be converted into TypeScript plugin, so it would think these aliases are declared in tsconfig.json.

Earlier I've used this command to generate jsconfig aliases from webpack config: https://github.com/zardoy/vetur-extended/blob/main/src/commands/generateJsconfigAliases.ts

MarioCadenas commented 2 years ago

How it can be implemented: https://github.com/zardoy/vscode-extension-patches/blob/e5110259bf2634a322b488ea7cf4c1d4b5b19254/extended-extensions/extensions/volar/all-features.patch#L1540-L1700 (I understand it might be hard to read) in my case it works just ideally

You can use it today with this extension in takeover mode in any projects. I can make pr to backport this native solution.

@MarioCadenas if you still care of this extension I think it should be converted into TypeScript plugin, so it would think these aliases are declared in tsconfig.json.

Earlier I've used this command to generate jsconfig aliases from webpack config: https://github.com/zardoy/vetur-extended/blob/main/src/commands/generateJsconfigAliases.ts

Hi @zardoy thanks for the interest, if you want to open a PR you are more than welcome πŸ˜„

Regarding the migration to typescript, I don't think I'll do it because I wouldn't really need that to use the tsconfig.json file, which also I'll add support for it

zardoy commented 2 years ago

Regarding the migration to typescript, I don't think I'll do it because I wouldn't really need that to use the tsconfig.json file

Absolutely didn't get that. Readme says VSCode has a way to do this by defining a jsconfig.json file, so I want this extension to not provide its own declaration/completion provide, but instead reuse this tsconfig.json's logic (TypeScript's paths logic) by extending/creating tsconfig.json aliases automatically. We can change this internally as we have full control of TypeScript server via plugin

It means it would work the same way, as if it was defined in tsconfig.json manually

MarioCadenas commented 2 years ago

Regarding the migration to typescript, I don't think I'll do it because I wouldn't really need that to use the tsconfig.json file

Absolutely didn't get that. Readme says VSCode has a way to do this by defining a jsconfig.json file, so I want this extension to not provide its own declaration/completion provide, but instead reuse this tsconfig.json's logic (TypeScript's paths logic) by extending/creating tsconfig.json aliases automatically. We can change this internally as we have full control of TypeScript server via plugin

It means it would work the same way, as if it was defined in tsconfig.json manually

I see, but if you already have the aliases defined in the tsconfig.json file, you don't need this extension πŸ˜… , VSCode will use the tsconfig to resolve those aliases πŸ˜„

The idea of this extension is to automatically get the aliases defined on webpack, or other files with a similar shape, and resolve them without having to define anything else, like the jsconfig file.

I would also like to extend it to other bundles like rollup, vite, etc