kronicdeth / intellij-elixir Goto Github PK
View Code? Open in Web Editor NEWElixir plugin for JetBrain's IntelliJ Platform (including Rubymine)
License: Other
Elixir plugin for JetBrain's IntelliJ Platform (including Rubymine)
License: Other
When I added sigils, I added support for modifiers at the end of the work and forgot to add the support to both the group format and heredoc format for sigils: currently only heredoc supports modifiers.
Group format such as ~r()i
should be accepted, but it is not while
~r"""
"""i
is accepted.
Even a simple file like this is completely red and no sensible Syntax highlighting.
defmodule Chat do
use Application
# See http://elixir-lang.org/docs/stable/Application.Behaviour.html
# for more information on OTP Applications
def start(_type, _args) do
Chat.Supervisor.start_link
end
end
The error is something like "ElixirTokenType... or ...[..] expected, but got 'd' "
Support ?
char tokens with literal characters and escape sequences as described here https://github.com/elixir-lang/elixir/blob/4b505286ec61b32cb791b79268ae6c58340c71f0/lib/elixir/src/elixir_tokenizer.erl#L166-L221.
Implement no_parens_op_expr
to complete match_expr
where it uses no_parens_expr
.
matched_expr
direct-dependenciesno_parens_op_expr
This is matched_expr
no_parens_op_expr
should be rewritten as binary operations with matchedExpression
as the left operand and noParenthesesExpression
as the right operand. This can be accomplished with either new binary operations or by changing the matchedExpression*Operation
s from #50 to accept either a matchedExpression
or a noParenthesesExpression
as the right operand.
noParenthesesExpression
as right operand to matchedExpressionMatchOperation
noParenthesesExpression
as right operand to matchedExpressionAdditionOperation
noParenthesesExpression
as right operand to matchedExpressionMultiplicationOperation
noParenthesesExpression
as right operand to matchedExpressionHatOperation
noParenthesesExpression
as right operand to matchedExpressionTwoOperation
noParenthesesExpression
as right operand to matchedExpressionAndOperation
noParenthesesExpression
as right operand to matchedExpressionOrOperation
noParenthesesExpression
as right operand to matchedExpressionInOperation
noParenthesesExpression
as right operand to matchedExpressionInMatchOperation
noParenthesesExpression
as right operand to matchedExpressionTypeOperation
noParenthesesExpression
as right operand to matchedExpressionPipeOperation
noParenthesesExpression
as right operand to matchedExpressionComparisonOperation
noParenthesesExpression
as right operand to matchedExpressionRelationalOperation
noParenthesesExpression
as right operand to matchedExpressionArrowOperation
noParenthesesExpression
as right operand to matchedExpressionWhenOperation
when
handling for no_parens_op_expr
has an additional right operand choice in addition to no_parens_expr
: call_args_no_parens_kw
call_args_no_parens_kw
as right operand to matcheExpressionWhenOperation
Allow the creation of Elixir projects from the New Project menu. This will include the use of mix to create the new project template. Feature request by @Claudiojlf in #6 (comment). Requested by @prodev42 in #77 and @andreacfm on stackoverflow.com
mix new
options using mix from Setup SDK.backet_at_expr
is used in access_expr
access_expr
direct-dependenciesbacket_at_expr
to accessExpression
bracket_at_expr
direct-dependenciesdot_bracket_identifier
bracket_identifier
.[
as BRACKET_IDENTIFIER.bracket_arg
direct-depenciesHandle dot
, which needs the rest to be operators (so complete #29 first), (
for anonymous function calls and interpolated function names. (For example, Keyword."get"([a: 1], :a)
is valid and the same as Keyword.get([a: 1], :a)
, so you can use a string or char list the after dot the same way you pass Symbols to send
in Ruby.) Finally, there is normal .
call syntax. All these forms need to accept multiple newlines and whitespace on either side of the .
.
.<three-token-operator>
(#114).<two-token-operator>
(#114).<one-token-operator>
(#114).(
parens_call
block_expr
unmatched_expr
expr
max_expr
access_expr
call_args_parens
.<string>
(Already complete in #105).<char-list>
(Already completed in #105)bracket_identifier
dot_bracket_identifier
bracket_arg
bracket_expr
access_expr
bracket_at_expr
access_expr
paren_identifier
dot_paren_identifier
parens_call
no_parens_one_expr
is part of matched_expr
. The dot_identifier
portion of it is currently implemented by matchedExpressionDotOperation
and identifierExpression
, but the call_args_no_parens_one
still needs to be implemented.
I was able to trigger do_identifier in the tokenizer like so:
iex(37)> :elixir_tokenizer.tokenize('one do end', 1, [])
{:ok, 1, [{:do_identifier, 1, :one}, {:do, 1}, {:end, 1}]}
This held into the parser too:
iex(38)> Code.string_to_quoted("one do end")
{:ok, {:one, [line: 1], [[do: nil]]}}
matched_expr
direct-dependenciesno_parens_one_expr
direct-dependenciesdot_op_identifier
may be subsumed by dot_op_identifier
in intellij-elixir if all op_identifiers are just lexed as IDENTIFIER.call_args_no_parens_one
dot_do_identifier
call_args_no_parens_one
direct-dependenciescall_args_no_parens_kw
should be implemented by #58matched_expr
should be implemented by #50no_parens_expr
should be implemented by #58Implement as much of no_parens_expr
as is possible given the pre-existing translation of elixir_parser.yrl
matchedExpression
(#50)no_parens_expr
direct-dependenciesexpression
dot_op_identifier
without overlapping matchedExpression
as that would lead to left-recursion that isn't handled by Grammar Kit's Pratt parsingdot_identifer
without overlapping matchedExpression
as that would lead to left-recursion that isn't handled by Grammar Kit's Pratt parsing.call_args_no_parens_many_strict
can be transliterated, in which case throw_no_parens_strict
needs to be converted to IntelliJ-style error handling using and annotator. Otherwise, this will just be call_args_no_parens_many
call_args_no_parens_many_strict
direct-dependenciescall_args_no_parens_many
matchedExpression
to not cause unresolvable left-recursion problems.call_args_no_parens_kw
and 2call_args_no_parens_comma_expr
call_args_no_parens_many -> matched_expr ',' call_args_no_parens_kw
call_args_no_parens_many -> call_args_no_parens_comma_expr
call_args_no_parens_many -> call_args_no_parens_comma_expr ',' call_args_no_parens_kw
call_args_no_parens_kw
direct-dependenciescall_args_no_parens_kw_expr
direct-dependenciescall_args_no_parens_expr
direct-dependenciescall_args_no_parens_comma_expr
direct-dependenciesmatchedExpression
matchExpression
matchedExpressionUnaryOperation
matchedExpressionAtOperation
matchedExpressionCaptureOperation
The current EOL token recognizes \r
, \n
, and \r\n
as EOL. The elixir tokenizer also recognizes ;
and EOL escapes. These additional capabilities need to be added.
container_args
is used in tuple
, used in bit_string
. container_args_base
is a direct dependency of container_args
and container_args_base
is used in list
list
direct-dependencieslist_args
direct-dependencieskw
as keywords
from list
rule in Elixir.bnf
.container_args_base
container_args_base
direct-dependenciescontainer_expr
emptyParentheses
matchExpression
There is a bug about highlighting comments:
# This comment will to displayed correctly
IO.puts "All your #{inspect tuple} are belong to us"
The last part of the second line #{inspect tuple} are belong to us"
will be displayed as a comment.
I dont know the name for the #{...}
syntax in strings, but it needs to be handled.
(I know its a early version, but i would like to document my findings.)
There is already support for base integers, but not for normal decimal integers and floats which parsed here
max_expression
is used in access_expr
and used in map_expr
.
access_expr
direct-dependenciesmax_expr
to access_expr
max_expr
direct-dependenciesparens_call
direct-dependenciesdot_paren_identifer
direct dependenciesdot_call_op
{DOT_OPERATOR} / {OPENING_PARENTHESES}
as DOT_CALL_OPERATOR
.call_args_parens
emptyParentheses
noParenthesesExpression
from #58.keywords
from #68call_args_parens_base
call_args_parens_base
containerExpression
from #68The current version of New > Elixir File, as so nicely provided by @abaire, doesn't differentiate between the File name and the Module name, so if you enter a Module name of Foo, the file is named Foo.ex, but Elixir convention is for the file name to be lowercase and underscored, so ExUnit Module name becomes ex_unit.ex. I tried debugging the Action and I'm not sure if using the CreateFileFromTemplateAction allows us to have a different File name and Module name since there is only one NAME attribute passed into the template. I may be possible to look at how the Package and Class creation actions work for Java and see if its possible to set the Module name as the PACKAGE_NAME or CLASS_NAME attribute and have the file name derived from that for the NAME attribute.
Empty parentheses are one form of valid expression. It will also entail adding support for open parenthesis, (
, and close parenthesis, )
that will be needed for containers, #37.
Implementing commas as operators in #29 does not makes sense as unlike other operators, commas should parse a list of expressions (that don't themselves contain commas) instead of nested binary operations. elixir_parser.yrl is able to get away with parsing commas as binary expressions because the yrl format allows the elements of a given rule to be concatenated into a flattened list. To do this in the bnf format for Grammar Kit I need to actually write a list like expression, which means separating operations into a different rule than comma so that comma only contains comma-less direct children to prevent left-recursion.
The map association operator, =>
is not used anywhere else, so it can be parsed by itself
access_expr
direct-dependenciesmap
to accessExpression
map
direct-dependencies%
instead of %{}
as MAP_OPERATOR. It will be used for both map_op
and struct_op
.map_args
map_expr
map_args
direct-dependencies{
as OPENING_CURLY}
as OPENING_CURLYmap_close
assoc_update
assoc_update_kw
map_close
direct-dependencieskw
((keywordPair (COMMA EOL* keywordPair)* COMMA?)?
) from list
in Elixir.bnf
assoc
assoc_base
assoc
direct-dependenciesassoc_base
assoc_expr
assoc_update
direct-dependenciesassoc_update_kw
map_expr
Be able to recovery from invalid digits in numbers so that parsing in pygment example doesn't stop at first invalid number example.
0B
and parse without PsiErrorElement0X
and parse without PsiErrorElement0b
and 0B
0o
.0x
and 0X
eoe
or End Of Expression is EOL or ;
. Right now EOL includes ;
in Elixir.flex, so that does not match the usage in Elixir's parser
backet_expr
is used in access_expr
access_expr
direct-dependenciesbacket_expr
to accessExpression
Any token that starts with a lowercase letter or underscore (_
) and does not match any other token type is an identifier
Lex regular keywords as distinct tokens from IDENTIFIER.
fn
as FNend
as ENDtrue
as TRUEfalse
as FALSEnil
as NILTRUE
to accessExpression
FALSE
to accessExpression
NIL
to accessExpression
The bit string syntax is used to declare and match binaries.
dot_op
is used for the call syntax. In Elixir's implementation, the parser matches .
directly, but in IntelliJ, I'll need to parse it in the lexer, Elixir.flex, as DOT_OPERATOR
and then use it in Elixir.bnf for the parser.
access_expr
tuple
to access_exprtuple
CLOSING_CURLY
and OPENING_CURLY
from #66.container_args
container_args
direct-dependencieskw
from #68container_args_base
from #68Comments currently consume the EOL to make combining multiline comments together easier, but this leads to trailing comments to eat the EOL, which means the required EOL between expressions is not there leading to invalid parses.
0x1 # does not consume EOL to separate 0x1 and 0x2
0x2 # does not have EOL at EOF
Expected:
Elixir File(0,81)
PsiElement(ElixirTokenType.NUMBER)('0x1')(0,3)
PsiWhiteSpace(' ')(3,4)
PsiComment(ElixirTokenType.COMMENT)('# does not consume EOL to separate 0x1 and 0x2')(4,50)
PsiElement(ElixirTokenType.EOL)('\n')(50,51)
PsiElement(ElixirTokenType.NUMBER)('0x2')(51,54)
PsiWhiteSpace(' ')(54,55)
PsiComment(ElixirTokenType.COMMENT)('# does not have EOL at EOF')(55,81)
Actual:
Elixir File(0,81)
PsiElement(ElixirTokenType.NUMBER)('0x1')(0,3)
PsiWhiteSpace(' ')(3,4)
PsiComment(ElixirTokenType.COMMENT)('# does not consume EOL to separate 0x1 and 0x2\n')(4,51)
PsiErrorElement:ElixirTokenType.EOL expected, got '0x2'(51,54)
PsiElement(ElixirTokenType.NUMBER)('0x2')(51,54)
PsiWhiteSpace(' ')(54,55)
PsiComment(ElixirTokenType.COMMENT)('# does not have EOL at EOF')(55,81)
Recognize aliases as module names. Note: Not all tokens with leading capital letters are aliases/Module names if they're followed by :
(<colon><space>
) then they should just be parsed as the atom keyword identifier for a Keyword list or map.
This builds on top of #19.
If a Module name has multiple levels, such as ExUnit.AssertionError
, then the file should have a nested path of ex_unit/assertion_error.ex
. It may be possible to determine how to do this by treating the ExUnit
has a PACKAGE_NAME and AssertionError
as a CLASS_NAME and seeing how the Java Class action work in the IDEA Community Edition source.
The current set of VALID_ESCAPE_SEQUENCE
VALID_ESCAPE_SEQUENCE = {ESCAPED_DOUBLE_QUOTES} |
{ESCAPED_SINGLE_QUOTE} |
{ESCAPED_INTERPOLATION_START}
is too limited and misses escapes of sigil terminators.
Not only should the sigil terminators be escapable, but VALID_ESCAPE_SEQUENCE
needs to be updated to cover all escapes that Elixir's lexer handles.
As a next smaller step, visual support for atoms might be cool.
I think i might not be abled to help developing, but testing for sure :)
Hi, I have installed the plugin successfully in IntellJ, however it doesn't not let me create elixir modules. What do I have to do to enable this?
in
is keyword for a binary operator used as an "include" operator as in
x = 1
x in [1, 2, 3] # true
kw
is a prereq for list_args
which is a prereq for list
, but list_args
and kw
don't make sense as independent expressions, so to implement kw
, implement list_args -> kw
and list -> open_bracket list_args close_bracket
to form a minimal list
. list
should be parsed as a value
in Elixir.bnf.
:
:
:
bit_string
is used in access_expr
.
access_expr
bit_string
to access_expr
bit_string
<<
as OPENING_BIT
>>
as CLOSING_BIT
container_args
from #66Part of the atom lexing overlaps with the keyword identifier when it uses the JSON syntax. <atom><colon>
should be parsed as <keyword_identifier>
.
stab
is used in access_expr
(and used in do_block
)
access_expr
direct-dependenciesfn_eoe stab end_eoe
open_paren stab close_paren
open_paren stab ';' close_paren
open_paren ';' stab ';' close_paren
stab
stab_expr
direct-dependenciesstab_maybe_expr
direct-dependenciesexpression?
call_args_no_parens_all
direct-dependenciesstab_parens_many
The pygment example has escape sequences with too many digits. These extra digits are currently lexed as a separate decimal number immediately adjacent to the valid escape sequences. This problem can be generalized to expressions being adjacent to each other with missing end-of-expressions. When end-of-expressions are missing, then the parser should recover. There should also be quick fixes to insert end-of-expressions.
Char Tokens make use of Char Escapes, so it makes sense to support Char Escapes prior to Char Tokens. This feature should take care of #14.
Matched expressions are calls with parentheses. They are the second type of expression after empty parentheses, #48.
dotAlias
dotIdentifier
Hi guys,
Here is the screenshot of what I had after installing new version.
The elixir tokenizer contains a 'Stand-alone token' for "...", which needs to be parsed as an identifier.
Use the pygment's example_elixir.ex that @alco developed to ensure feature parity with pygment's highligher.
I tried opening this file, but PHPStorm seem to freeze:
https://github.com/marcioj/elixir_blog/blob/master/lib/blog.ex
No Error message on the console :(
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.