Closed aaannestad closed 9 months ago
I can confirm the bug, reproducible in both python3.10 and python3.11.
Fixed the error but I find it's not enough -- semantic highlight isn't quite correct. I will fix that too.
def test_match(arg, foo=False):
match arg:
case 42:
print('constant')
case foo:
# case arg:
print('arbitrary matching')
This version of semshi throws an error when trying to open a file involving Python 3.10's
match
/case
syntax. (I've switched to this from the original numirias/semshi because that just treats a use ofmatch
as an error in your Python code!) It's possible this is my fault for switching from numirias/semshi incorrectly, but all other Python files seem to open just fine - it's only files using thematch
/case
syntax that throw an error.Steps to reproduce:
test(False)
Feil oppdaget under prosessering av BufReadPost Autokommandoer for "": Error executing lua callback: /usr/share/nvim/runtime/filetype.lua:24: Error executing lua: /usr/share/nvim/runtime/filetype.lua:25: BufReadPost Autokommandoer for ""..FileType Autokommandoer for ""..function12_filetype_changed[4]..remote#define#CommandBootstrap[5]..remote#define#request, line 2: Vim(let):Error invoking '/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi:command:Semshi' on channel 3 (pytho
n3-rplugin-host):Feil oppdaget under prosessering av BufReadPost Autokommandoer for " ":
Error executing lua callback: /usr/share/nvim/runtime/filetype.lua:24: Error executing lua: /usr/share/nvim/runtime/filetype.lua:25: BufReadPost Autokommandoer for ""..FileType Autokommandoer for ""..function 12_filetype_changed[4]..remote#define#CommandBootstrap[5]..remote#define#request, line 2: Vim(let):Error invoking '/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi:command:Semshi' on channel 3 (pytho
n3-rplugin-host):
error caught in request handler '/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi:command:Semshi [['enable']]':
Traceback (most recent call last):
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/plugin.py", line 151, in cmd_semshi
func(self, args[1:])
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/plugin.py", line 35, in wrapper
func(self, args, kwargs)
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/plugin.py", line 174, in enable
self.highlight()
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/plugin.py", line 35, in wrapper
func(self, *args, *kwargs)
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/plugin.py", line 197, in highlight
self._cur_handler.update(force=True, sync=True)
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/handler.py", line 71, in update
self._update_step(force=force, sync=True)
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/util.py", line 19, in wrapper
res = func(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/handler.py", line 163, in _update_step
add, rem = self._parser.parse(code, force)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/util.py", line 19, in wrapper
res = func(*args, kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/parser.py", line 47, in parse
return self._parse(*args, *kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/parser.py", line 68, in _parse
new_nodes = self._make_nodes(code, new_lines, change_lineno)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/parser.py", line 108, in _make_nodes
return visitor(lines, symtable_root, ast_root)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/util.py", line 19, in wrapper
res = func(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/visitor.py", line 50, in visitor
visitor.visit(ast_root)
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/visitor.py", line 130, in visit
self._iter_node(node)
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/visitor.py", line 413, in _iter_node
self.visit(item)
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/visitor.py", line 120, in visit
self._iter_node(node)
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/visitor.py", line 413, in _iter_node
self.visit(item)
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/visitor.py", line 135, in visit
self._iter_node(node)
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/visitor.py", line 413, in _iter_node
self.visit(item)
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/visitor.py", line 135, in visit
self._iter_node(node)
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/visitor.py", line 417, in _iter_node
self.visit(value)
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/visitor.py", line 135, in visit
self._iter_node(node)
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/visitor.py", line 417, in _iter_node
self.visit(value)
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/visitor.py", line 135, in visit
self._iter_node(node)
File "/home/[USER]/.local/share/nvim/plugged/semshi/rplugin/python3/semshi/visitor.py", line 404, in _iter_node
for field in node._fields:
^^^^^^^^^^^^
AttributeError: 'bool' object has no attribute '_fields'
stack traceback:
[C]: in function 'nvim_cmd'
/usr/share/nvim/runtime/filetype.lua:25: in function </usr/share/nvim/runtime/filetype.lua:24>
[C]: in function 'nvim_buf_call'
/usr/share/nvim/runtime/filetype.lua:24: in function </usr/share/nvim/runtime/filetype.lua:10>
stack traceback:
[C]: in function 'nvim_buf_call'
/usr/share/nvim/runtime/filetype.lua:24: in function </usr/share/nvim/runtime/filetype.lua:10>
Trykk ENTER eller skriv kommando for å fortsette