I noticed that in Rust, `println!`being a macro, it matched the color of string literals. This was visually confusing to me, so I checked what the nvim catpuccin theme (https://github.com/catppuccin/nvim) does. While it is pretty different, it does use different colors for strings and all function types: https://share.cleanshot.com/RLG2y1
I don't know if blue or red makes more sense given the other syntax choices, but wanted to propose this change cc @IsotoxalDev
The update to the grammar itself covers the case where the document
is a single expression without a trailing newline such as "min(A, B)".
A small change to the parser now parses these expressions correctly
which improves the display of the function head in the signature
help popup.
The update to the queries marks 'andalso', 'orelse', 'not', etc. as
`@keyword.operator` which improves the look - it looks odd to see
operators that are words highlighted the same as tokens like '->'
or '=:='.
the bottom value is used, so i've removed the top `ui.help` values from all themes
also, the values are not merged, so:
```toml
"ui.help" = { modifiers = ["reversed"] }
"ui.help" = { fg = "white", bg = "black" }
```
is equal to:
```toml
"ui.help" = { fg = "white", bg = "black" }
```
* str, list, etc. handled as @function.builtin and @type.builtin
* None and non-conforming type indentifiers as @type in type hints
* class identifiers treated as @type
* @constructor used for constructor definitions and calls rather than
as a catch-all for type-like things
* Parameters highlighted
* self and cls as @variable.builtin
* improved decorator highlighting as part of @function
Re-ordering of some statements to give more accurate priority.
* Adds tutorial sections for multiple areas including:
- Changing selections to uppercase / lowercase
- yanking and pasting
- macros
- selecting to chars with t and f
PS: I got kind of carried away and put off commiting for a while,
will commit to commit more often in the future.
* Changed section titles to all uppercase
* Added recap and section about jumplist
* Added sections for searching in file, joining lines and indenting lines.
* Removed some trailing whitespace
* Evened out the space between sections to all be 5 lines
* Add section on opening lines (o) and recap
* Changed the amount of lines between sections
This is so that - on a 24 line terminal -
only one section is visible at a time and
page up/page down goes straight to the next
section keeping the header at the top.
* Punctuation error
Co-authored-by: Omnikar <omkar.subramaniam@icloud.com>
* Punctuation error
Co-authored-by: Omnikar <omkar.subramaniam@icloud.com>
* Spelling error
Co-authored-by: Omnikar <omkar.subramaniam@icloud.com>
* Remove unnecessary word
Co-authored-by: Omnikar <omkar.subramaniam@icloud.com>
* Reword note about searches
Co-authored-by: Omnikar <omkar.subramaniam@icloud.com>
* Change word
Co-authored-by: Omnikar <omkar.subramaniam@icloud.com>
* Update tutor file
* Made some small changes suggested by Omnikar
* Added better demo for macros.
* Small changes
- Add newlines at the end
- Make "MACROS" section fit into 22 lines
- Correct mistake of saying helix copied to clipboard in "COPYING AND PASTING TEXT"
* Reformatted notes in copying/pasting section to fit in screen
* Add a note about n and N and their difference to Vim.
* Combine f and t commands into one section.
* Removed t/T section which was merged into the f/F section.
* Merge sections on manipulating case into one.
* Gave section's numbers
* Convert 'press' to 'type' in some places
* Added examples of how prompt lines should look.
* Reformatted notes in copy/pasting section.
* More rewording to more comfortably fit sections on screen.
* Grammatical error.
* Missing periods.
* Missing capital + small reformat
* Fix mis-numbered section
* Reworded to use these conventions when referring to inputs:
- "Press" for single keypresses
- "Type" for multiple keypresses / modifiers
- "Use" when referencing two inputs as a pair.
* till not 'til
* Say 'press' instead of 'type' when referring to symbols
* 'outdent' not 'unindent'
* Typo and grammar.
* Replace all 'press's with 'type's (apart from places it would make no sense in).
* Improve examples for joining and indenting lines.
* Section alignment.
Co-authored-by: Omnikar <omkar.subramaniam@icloud.com>
* log textobject query construction errors
The current behavior is that invalid queries are discarded silently
which makes it difficult to debug invalid textobjects (either invalid
syntax or an update may have come through that changed the valid set
of nodes).
* fix golang textobject query
`method_spec_list` used to be a named node but was removed (I think
for Helix, it was when updated to pull in the support for generics).
Instead of a named node for the list of method specs we have a bunch
of `method_spec` children nodes now. We can match on the set of them
with a `+` wildcard.
Example go for this query:
type Shape interface {
area() float64
perimeter() float64
}
Which is parsed as:
(source_file
(type_declaration
(type_spec
name: (type_identifier)
type: (interface_type
(method_spec
name: (field_identifier)
parameters: (parameter_list)
result: (type_identifier))
(method_spec
name: (field_identifier)
parameters: (parameter_list)
result: (type_identifier))))))
HEEx is a templating engine on top of Elixir's EEx templating
language specific to HTML that is included in Phoenix.LiveView
(though I think the plan is to eventually include it in base
Phoenix). It's a superset of EEx with some additional features
like components and slots.
The injections don't work perfectly because the Elixir grammar is
newline sensitive (the _terminator rule). See
https://github.com/elixir-lang/tree-sitter-elixir/issues/24
for more information.
This will become more important with the HEEx grammar being added.
Error highlighting with the Elixir grammar is a bit jumpy because
in some scenarios, a bit of missing syntax can force tree-sitter to
give up on error recovery and mark the entire tree as an error.
This ends up looking bad when editing. We don't typically highlight
error nodes so I'm inclined to leave it out of the highlights here.
After the incremental parsing rewrite for injections (which was released
in 22.03 https://helix-editor.com/news/release-22-03-highlights/#incremental-injection-parsing-rewrite),
we can now do combined injections which lets us pull in some templating
grammars. The most notable of those is embedded-template - a pretty
straightforward grammar that covers ERB and EJS.
The grammar and highlights queries are shared between the two but they have
different injections.
It looks like a24fb17b2a (and
855e438f55) broke the typescript
highlights because typescript
; inherits: javascript
but it doesn't have those named nodes in its grammar.
So instead we can separate out JSX into its own language and copy
over everything from javascript and supplement it with the new
JSX highlights. Luckily there isn't too much duplication, just the
language configuration parts - we can re-use the parser with the
languages.toml `grammar` key and most of the queries with `inherits`.