thqby / vscode-autohotkey2-lsp

Autohotkey v2 Language Support using vscode-lsp.
https://marketplace.visualstudio.com/items?itemName=thqby.vscode-autohotkey2-lsp
GNU Lesser General Public License v3.0
220 stars 21 forks source link

textDocument/completion: Invalid regular expression #489

Closed RaptorX closed 7 months ago

RaptorX commented 8 months ago

Type: Bug

I get this error when I start typing a completion of a static property that happens to be an object:

[Error - 2:30:13 PM] Request textDocument/completion failed. Message: Request textDocument/completion failed with message: Invalid regular expression: /^\s@prop(erty)?\s+{(.[^])?}\s+Type(\s|$)/im: Unterminated character class Code: -32603

This property definition can be found on Descoladas UIA-v2 library. It was working fine before.

class UIA {
static Type := {Button:50000,Calendar:50001,CheckBox:50002,ComboBox:50003,Edit:50004,Link:50005, 
Hyperlink:50005,Image:50006,ListItem:50007,List:50008,Menu:50009,MenuBar:50010,MenuItem:50011,ProgressBar:50012,
RadioButton:50013,ScrollBar:50014,Slider:50015,Spinner:50016,StatusBar:50017,Tab:50018,TabItem:50019,Text:50020,ToolBar:50021,ToolTip:50022,Tree:50023,TreeItem:50024,Custom:50025,Group:50026,Thumb:50027,DataGrid:50028,
DataItem:50029,Document:50030,SplitButton:50031,Window:50032,Pane:50033,Header:50034,HeaderItem:50035,
Table:50036,TitleBar:50037,Separator:50038,SemanticZoom:50039,AppBar:50040, base:this.Enumeration.Prototype}
}

Extension version: 2.3.7 VS Code version: Code 1.87.2 (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:20:17.278Z) OS version: Windows_NT x64 10.0.22621 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-4460 CPU @ 3.20GHz (4 x 3198)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.88GB (20.82GB free)| |Process Argv|S:\\Prompt Assistant --crash-reporter-id 3e042e59-cb22-4371-968a-6f3e35abe666| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscorecescf:30445987 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:30899288 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 pythontbext0:30879054 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 pydisww1:30991133 cppperfnew:30979542 d34g3935:30971562 fegfb526:30981948 bg6jg535:30979843 ccp1r6:30958156 dsvsc020:30976470 ```
GroggyOtter commented 8 months ago

Yeah I'm getting these too.

This is completely valid code and runs fine, but every time the color array is accessed, the addon freaks out:

    F1::pick_a_color()

    pick_a_color() {
        ; Default color set
        static default_color := [
            "FF0000",
            "FFA800",
            "6CFF00",
            "00FFDE",
            "9600FF",
            "FF4E4E",
            "FFFD4E",
            "00FF72",
            "0054FF",
            "FF00FC"
        ]

        ; Color array to pull from
        static color := []

        ; When color array is empty
        if (color.Length < 1) {
            color := []
            for value in default_color
                color.Push(value)
        }

        ; Randomly pick a color and remove it
        choice := color.  ; <----immediately errors when the dot is typed
        ;; Error message: Request textDocument/completion failed.
        ;; Message: Request textDocument/completion failed with message: Invalid regular expression: /^\s*@(var)\s+{(.*[^\])?}\s+color(\s|$)/im: Unterminated character class
        ;; Code: -32603 

        ; Send color choice
        Send(choice)
    }

Also this: