orbitalquark / textadept

Textadept is a fast, minimalist, and remarkably extensible cross-platform text editor for programmers.
https://orbitalquark.github.io/textadept
MIT License
653 stars 39 forks source link

`lexer.detect_patterns` doesn't seem to work in last nightly #322

Closed paaguti closed 1 year ago

paaguti commented 1 year ago

I have

lexer.detect_patterns['^#!.+[/ ]tcc'] = 'ansi_c'

in my .textadept/init.lua and a file that starts with

#!/usr/bin/env tcc -run

is not detected as ANSI C

More information.. I have added a couple of prints to see what is happening: in my .textadept/init.lua:

lexer.detect_patterns is    table: 0x55c06c074e30
^#[ ]*cloud%-config -> yaml
^#!.+ JavaScript -> javascript
^.+ P4_16 -> p4_16
^#!.+[/ ]tcc -> ansi_c
^#!.+[/ ]make -> makefile
lexer.detect_extensions is  table: 0x55c06c074df0
fs -> forth
p4 -> p4_16
changelog -> changelog
bash_profile -> bash
zshenv -> bash
bash_aliases -> bash
zshrc -> bash
yang -> yang

And then in lexers/lexer.lua I see that the module has its tables and their size is 0, because they aren't the same as in .textadept/init.lua

Trying the shebang with     table: 0x55e7e549a310   0
Trying the extensions with  table: 0x55e7e549a2d0   0
orbitalquark commented 1 year ago

Thanks for the report. Fixed via https://github.com/orbitalquark/scintillua/commit/b87f598024446a47752ad551cf6f922fb772fa4f and https://github.com/orbitalquark/textadept/commit/119c788e5bc241d6ffb9f665219a2cb207dbd232.