ipatalas / vscode-postfix-ts

Postfix notation for TypeScript/Javascript - extension for VS Code
MIT License
158 stars 43 forks source link

Can we generalize this #20

Closed altimmons closed 5 years ago

altimmons commented 5 years ago

I think there are a number of us coming from Jetbrains products- e.g. Webstorm, IntelliJ (me), PyCharm, Resharper, etc. that really miss this.

I am still working in mostly Java. I've been trying to see if I can get the Textmate snippet syntax to behave in this fashion using RegEx. But its hard.

It would be great if this could be generalized, accept some user input file, and work for other languages. I saw a feature request for this ability in Python (where someone linked to this project and how I ended up here).

I could pick apart your extension and give it a go when I've got a bit of time. But I always like to suggest it first to the extension owner as A) You are way more familiar with the extension, B) I am way less familiar with TS/JS, and C) I always hate it when someone takes an extension, tweaks it slightly then pushes it as their own work. I mean I know its open source and all, but the academic part of me still cringes with plagarism nightmares.

Looking through your code, most of it looks doable. There are a few language specific sticking points. I am still learning the VS Code API so IDK. I'll take another look as soon as I post this.

ipatalas commented 5 years ago

It would be great if this could be generalized, accept some user input file, and work for other languages.

That was my intention at the very beginning. However it turned out to be more difficult. Syntax for different languages differ and it was hard to just base on text (RegExp). That's why I rely on Typescript lib itself to parse the source code and use AST to handle most of the stuff (much more reliable).

I could pick apart your extension and give it a go when I've got a bit of time. But I always like to suggest it first to the extension owner as A) You are way more familiar with the extension, B) I am way less familiar with TS/JS, and C) I always hate it when someone takes an extension, tweaks it slightly then pushes it as their own work. I mean I know its open source and all, but the academic part of me still cringes with plagarism nightmares.

Appreciate it :)

Looking through your code, most of it looks doable. There are a few language specific sticking points. I am still learning the VS Code API so IDK. I'll take another look as soon as I post this.

VS Code API is really easy to learn and it's rarely the difficult part of the extension. The idea sounds good but as you may have already noticed I don't have too much time to maintain my extensions. I've got few of them and do it all in my free time. That's why I was mainly focused on what I needed at the time but still happy to accept ideas or PRs. If you have an idea how to start please tell me so.

We can try to do that together by isolating the language specifics first one step at a time and making this part easily pluggable for other languages. However there is a downside of that approach. typescript dependency itself is like ~42MB alone bloating the extension's size. If we added support for other languages and used a dedicated parser for each of them we may end up in really big size of the extension. I know it's not 2000 anymore and people have bandwidth today but still it hurts me inside. Additionally it may cause people to download the extension just to use let's say 1/2 out of 10 supported languages which also feels like an overkill to me.

I'd rather go towards making a pretty extensible "engine" for building the extensions so that it's relatively easy to add support for different languages. That's what basically happened, there are a couple of forks which are already published in the marketplace and working - Go and Python so far I think. It's still tightly coupled to Typescript though and that I would like to change. If we can separate the part responsible for just parsing the code of given language from the completion itself that would be great and make it even easier to work with in the future. What do you think?