rikvdkleij / intellij-haskell

IntelliJ plugin for Haskell
https://rikvdkleij.github.io/intellij-haskell/
Apache License 2.0
1.31k stars 94 forks source link

Language injection for strings #340

Closed ice1000 closed 5 years ago

ice1000 commented 5 years ago

Like this image

I may create a PR for this.

ice1000 commented 5 years ago

@rikvdkleij To impl this, I need a special AST type for string literals, while currently there isn't one:

private literal             ::= DECIMAL | HEXADECIMAL | OCTAL | FLOAT | CHARACTER_LITERAL | STRING_LITERAL

private general_id          ::= QUASIQUOTE | q_name | symbol_reserved_op | reserved_id | LEFT_PAREN | RIGHT_PAREN | FLOAT |
                                  SEMICOLON | LEFT_BRACKET | RIGHT_BRACKET | literal | LEFT_BRACE | RIGHT_BRACE |
                                  COMMA | QUOTE | BACKQUOTE | fixity |
                                  inlinelike_pragma | DIRECTIVE | scc_pragma

private line_expression     ::= general_id+

I need you to modify the AST shape, cus it's large change and we have different Grammar-Kit version, which is gonna cause some large diff

ice1000 commented 5 years ago

Ping?

rikvdkleij commented 5 years ago

Can we not sync our grammar kit versions?

I want to release new beta today and tomorrow I got on holiday. I have no time. Also afraid to break thing now.

I would say, just go ahead.

Btw, what is the purpose of having Haskell language injection for strings?

ice1000 commented 5 years ago

I want to release new beta today and tomorrow I got on holiday. I have no time. Also afraid to break thing now.

I understand. So you mean I can re-generate the parser and cause a large diff?

ice1000 commented 5 years ago

Btw, what is the purpose of having Haskell language injection for strings?

Example usage taken from my plugin:

ice1000 commented 5 years ago

Notice the doc-string above before line 32, and the regex string at line 39.

rikvdkleij commented 5 years ago

Notice the doc-string above before line 32, and the regex string at line 39.

Sorry, but I do not see it...

ice1000 commented 5 years ago

image

rikvdkleij commented 5 years ago

So you mean I can re-generate the parser and cause a large diff?

Well, you can just develop with your locally generated parser and later we will see. Maybe we can use the same grammar kit version later. It could also be that the large diff is caused by optimized imports.

ice1000 commented 5 years ago

It could also be that the large diff is caused by optimized imports.

Yeah and the generated code style is now different.

ice1000 commented 5 years ago

Closing as implemented.