Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotated highlights work in Color Settings Page #320

Merged
merged 45 commits into from Jun 9, 2016
Merged

Annotated highlights work in Color Settings Page #320

merged 45 commits into from Jun 9, 2016

Conversation

KronicDeth
Copy link
Owner

@KronicDeth KronicDeth commented Jun 9, 2016

Changelog

Enhancements

  • Show annotator applied highlights in the Preferences > Editor > Colors & Fonts > Elixir.
    • Errors
    • Alias
    • Braces and Operators
      • Bit (<< and >>)
      • Braces ({ and })
      • Brackets ([ and ])
      • Char Tokens (?)
      • Comma (,)
      • Dot (.)
      • Interpolation (#{ and })
      • Maps and Structs
        • Maps (%{ and })
        • Structs (%{ and } when used for struct. The Alias is still highlighted using Alias)
      • Operation Sign
      • Parentheses (( and ))
      • Semicolon (;)
    • Calls
      • Function (currently only combined with Predefined to highlight Kernel functions. Will be used later for all function calls once function references are implemented.)
      • Macro (curently only combined with Predefined to highlight Kernel and Kernel.SpecialForms macros. Will be used later for all macro calls once macro references are implemented.)
      • Predefined (Combined with Function to highlight Kernel functions. Combined with Macro to highlight Kernel and Kernel.SpecialForms macros.)
    • Escape Sequence
    • Module Attributes
      • Documentation (Previously Documentation Module Attributes)
        • Text (Previously Documentation Text)
      • Types
        • Callback (my_callback in @callback my_callback() :: :ok or my_macro_callback in @macrocallback my_macro_callback)
        • Specification (my_function in @spec my_function() :: :ok)
        • Type
          • typ and integer in @type typ :: integer
          • parameterized in @type parameterized(type_parameter) :: type_parameter
          • typtyp in @opaque typtyp :: 1..10
          • typ and typtyp in @callback func(typ, typtyp) :: :ok | :fail
          • binary andutf8in<< "hello" :: binary, c :: utf8, x = 4 * 2 >> = "hello™1"`
      • Type Parameters (type_parameter in @type parameterized(type_parameter) :: type_parameter)
    • Numbers
      • Binary, Decimal, Hexadecimal, and Octal Digits (Previously at top-level.)
      • Decimal Exponent, Mark and Separator (Previously at top-level)
      • Invalid Binary, Decimal, Hexadecimal, and Octal Digits (Previously at top-level.)
      • Non-Decimal Base Prefix (Previously at top-level.)
      • Obsolete Non-Decimal Base Prefix
    • Variables
      • Ignored
      • Parameter
      • Variable
  • Recover in expression until close of subexpression
    • \n
    • \r\n
    • >>
    • ]
    • }
    • )
    • ;
    • ->
    • end
    • after
    • catch
    • else
    • rescue
  • Update Preferences > Editor > Colors & Fonts > Elixir example text's bitstring syntax to Elixir post-1.0.0 (Use - to separate segment options instead of a list.)
  • Use same algorithm for ElixirStabBody and ElixirFile because they are sequences of expressions.
  • Highlight atom keywords (false, nil, and true) as merge of Atom and Keyword text attributes. If both only use foreground color, Keyword wins.
  • Annotate QualifiableAlias as Alias.
  • Highlight keyword list and map keywords (<key>:) as Atom.
  • Add with to highlighted special forms

Bug Fixes

  • Stab operation parameter Use Scope is the stab operation.
  • Skip over PsiLeafElement when looking for variables because the PsiLeafElement is an error.
  • In a script file where the parent of a Match is a PsiFile, the Match Use Scope is the rest of the file.
  • Add = to Operator Signs
  • Skip NoParenthesesKeywords when highlighting types, which occurs when the :: has no proper right operand and the following one-liner function clause with do: is parsed as the right operand.
  • Skip DUMMY_BLOCK when looking for Variable, which prevents walking through errors.
  • Use Normalized pattern for Prefix, so that the operand is null when only the operator matches or the operand has errors.
  • Work-around Phoenix .ex templates that contain EEX: if <%= from EEX is detected, don't throw error when Modular can't be found.
  • Fix capitalization error in example text

Incompatible Changes

  • Preferences > Editor > Colors & Fonts > Elixir restructured to group together related highlights and to match grouping used for Colors & Fonts > Language Defaults and Colors & Fonts > Java.
    • Documentation Module Attributes renamed to Module Attributes > Documentation
    • Documentation Text renamed to Module Attributes > Documentation > Text
    • Expression Substitution Mark renamed to Braces and Operators > Interpolation.
    • The following are now nested under Numbers instead of being at the top-level:
      • Binary, Decimal, Hexadecimal, and Octal Digits
      • Decimal Exponent, Mark and Separator
      • Invalid Binary, Decimal, Hexadecimal, and Octal Digits
      • Non-Decimal Base Prefix
      • Obsolete Non-Decimal Base Prefix

When EscapeSequence were converted from tokens to elements, their
highlighting was lost, so restore it by adding an annotator for
EscapeSequence elements.
Helps limit errors in example text to only until the following tokens:
* \n
* \r\n
* >>
* ]
* }
* )
* ;
* end
I'm not sure why this wasn't triggered before when testing
elixir-lang/elixir, but the pygment example text did trigger that this
was missing.
It was still using the pre-1.0 list syntax.
Occurs when typing `Alias.` on the `.`.
In a script file where the parent of a Match is a PsiFile, the Match
useScope is the Match and the rest of the file.
Use same algorithm for ElixirStabBody and ElixirFile because they are
sequences of expressions.
Atom keywords are `false`, `nil`, and `true`. If both only use foreground color,
keyword wins.
Matches how Rubymine does highlighting for JSON hashes.
{ and } are highlighted as Braces and Operators > Braces to match Java.
Also make it derive from BRACES because {} is used for interpolation.
Key is left as ELIXIR_EXPRESSION_SUBSTITUTION_MARK for any saved themes.
Don't have TextAttributeKeys for Kernel Functions, Kernel Macros, and
Kernel.SpecialForms Macros, instead have Calls/Function,
Calls/Predefined, and Calls/Macro.  Then, Kernel Functions =>
Calls/Function+Calls/Predefined, Kernel Macros and Kernel.SpecialForms
Macros => Calls/Macro+Calls/Predefined.

Having so many highlighters now revealed a bug that the Kernel annotator
highlighted the entire call, not just the function name element, so it
was miss highlighting everything in the body of a `def` or `defmodule`
that didn't have another highlighter that won.
Not sure why it wasn't already in there.
Occurs when the `::` has no proper right operand and the following
one-liner function clause with `do:` is parsed as the right operand.
Prevents walking through errors.
Uses the Normalized pattern used for Infix.
If `<%=` from EEX is detected, don't throw error when Modular can't be
found.
@KronicDeth KronicDeth self-assigned this Jun 9, 2016
@KronicDeth KronicDeth merged commit 9d3231b into master Jun 9, 2016
@KronicDeth KronicDeth deleted the 299 branch June 9, 2016 14:37
KronicDeth added a commit that referenced this pull request Jun 12, 2016
KronicDeth added a commit that referenced this pull request Jun 14, 2016
@KronicDeth KronicDeth added this to the v4.0.0 milestone Jun 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant