Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

Any plans for a PHPStorm plugin? #9

Open
enumag opened this issue Sep 12, 2019 · 6 comments
Open

Any plans for a PHPStorm plugin? #9

enumag opened this issue Sep 12, 2019 · 6 comments

Comments

@enumag
Copy link

enumag commented Sep 12, 2019

As you noted in the Prologue, the main drawback of using Plus now is the lack of IDE support. In my opinion the project doesn't have much chance of being used in real applications without a PHPStorm plugin - personally I certainly wouldn't use Plus until then. Also I think this is ultimately the main reason why Pre never got much community attention. Are there any plans for this?

@olivernybroe
Copy link

@assertchris did you ever start on a PhpStorm plugin for Pre? If you did, do you have any pointers for us? ❤️

@joshdifabio
Copy link

Another option could be a language server.

@assertchris
Copy link

@olivernybroe Nope. Focussing on the standard library first. I think @brendt started looking into it, and might know what's involved.

@brendt
Copy link

brendt commented Sep 12, 2019

I'd say that adding proper IDE support is way more difficult than transpiling custom syntax to runnable PHP.

I was thinking about it this morning: take for example the readonly keyword. It's one thing to not have your IDE mark this is invalid syntax, but it's another thing to have it know what readonly actually means, and mark $class->readonlyProp = 'abc' as an error.

Thinking about it, readonly might be doable, but what about generics, or having type support for enums.

I'm sure it's doable, but I'd say being able to transpile custom syntax to PHP is only the tip of the iceberg when speaking about a "workable solution".

@olivernybroe
Copy link

@brendt Yep, get you. That is a lot of work to make it understand it all in the right way, not just see it as valid syntax.

However just getting it to see it as valid syntax is a big task.
I know very little about extending languages in IntelliJ, but to make this, it sounds like we would have to write our own Lexer, Parser, PSI and so on, as the built in lexer in IntelliJ won't parse the file, because it is not valid PHP.
Hopefully somebody knows of a way to do this, maybe there is some other language which works this way, that IntelliJ got support for? Then we at least have some code to get inspired by.

@enumag
Copy link
Author

enumag commented Sep 12, 2019

Overall I think it's actually easier to write the preprocessor to compile the new syntax into pure PHP than it is to support it in PHPStorm. Because of that it is my opinion that if this project wants to have any chance for realworld adoption then the IDE support should be the primary focus and not just something that "will be added later". It's unrealistic to write it later from scratch when the project already has a lot of features. It would be better to check if it's even reasonably doable now when there is not a whole lot of features yet and only add features that can have IDE support later. Also don't forget that it can't even be done as "separate language" for the IDE. That way the plugins for Symfony, Doctrine etc. would not work with it which is kind of a must-have as well imo. Without a real focus on it now I fear that the IDE support will just never happen, ultimately making this project a waste of time for everyone involved because the project will only ever be used by the author and perhaps a few fans who aren't using an IDE anyway. Prove me wrong.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants