The closing ``` in the following example was not detected because the
indented code block highlighter was higher up in the hierarchy than the
fenced code block highlighter:
```
indented
```
The codeblock highlighter used to be inline so that it has an effect
inside listblocks. This commits adds a listblock/codeblock highlighter
as a replacement.
Fixes#4351
- Also insert "end" after "do", "else" and "elseif"
- Do not insert "end" after strings or comments containing keywords
- Only insert "end" if the block is empty
An example of the last item is if we want to add a new line to the start
of an unclosed block that already contains statements. @ is the cursor.
-- before
if a then@
x = 1
y = 2
-- after
if a then
@
end
x = 1
y = 2
In this case, inserting the "end" before the statements is probably not
what the programmer wants. It might make more sense to insert the "end"
after the statements, but that is potentially confusing due to spooky
action at a distance. I think the least confusing thing to do in this
situation is to not insert the "end".
This commit makes several improvements to the Lua indentation logic.
- Don't indent if the keyword is inside a string or comment
- Indent inside "do end"
- Indent inside "repeat until"
- Indent after a line ending with "{" or "("
- More accurate un-indentation for the "end" keyword
For the last point, previously we tried to match the indentation of the
starting keyword of the block. However, sometimes this guessed wrong
and produced the wrong indentation, as the following example shows. The
new logic is to indent the "end" by one less level than the contents of
the block.
while true do
if false then
end
end -- This was incorrectly matched with the "if"
kak-lsp uses these faces to mark errors inside the buffer, instead of the Error
face which is much more jarring, and which does not have an associated warning
face. Since the :spell command marks errors inside the buffer, it's also updated
to use this new face.
Adding these faces to Kakoune makes it more likely that colorschemes will
automatically do the right thing when used with kak-lsp, and makes it possible
to use a subtle appearance (like curly underlines) for in-buffer errors while
keeping Kakoune errors bold and jarring as they should be.
rockspec files are used by [Luarocks](https://luarocks.org/), the
most prominent package manager for Lua. Despite the different file
extension, these files are actually Lua files and should be syntax
highlighted as such.
For what it is worth, Neovim also does the same thing that I am doing in
this commit. They recognize both ".lua" and ".rockspec" as being Lua
files (and no other extensions, as far as I know).
This fixes a bug in how the Lua scripts handle new comment lines.
Currently if we have a comment that is indented, when we add a new line
it inserts the `--` prefix before the automatic indentation.
```
--ABC
-- XYZ
```
After the fix, it correctly inserts the comment prefix after the
indentation:
```
--ABC
--XYZ
```
The solution I used is inspired by the ruby.kak script.
If the session wasn't valid anymore by the time the linter finishes,
writing to "$dir"/fifo would hang forever leaving temporary files in
/tmp/kak-lint.XXX and the process alive. This commit fixes that by
not writing to the fifo if the session was not valid.
throwawayaccount12345-1 Copyright Waiver
I dedicate any and all copyright interest in this software to the
public domain. I make this dedication for the benefit of the public at
large and to the detriment of my heirs and successors. I intend this
dedication to be an overt act of relinquishment in perpetuity of all
present and future rights to this software under copyright law.
Correctly indentint on "end" keyword seems very hard,
it is simpler to remove it. And we already insert "end"
in ruby-insert-on-new-line hook, so the removal shouldn't
hurt too much.
currently focus client doesn't work if target pane of the client is in different tab or window from current one.
select window, select tab should be triggered in order to select a pane on a currently not focused tab or window.
1. Deleted back-tick strings which are not a valid Dart syntax
2. Added string interpolation for ${}
3. NOT adding string interpolation for $var as this is considered a bad practice
This commit adds highlighting characters other than the first with red color helping to get immediate feedback of the syntax error.
This helps those who come from languagles like JS where single quotes also denote multi-character strings.
Adding highlighting for string interpolation inside double-quoted strings and character literals inside single-quotes.
Avoiding string interpolation in the form of $var as this is considered bad practice.