phil294 / coffeesense

IntelliSense for CoffeeScript. LSP implementation / VSCode extension
MIT License
47 stars 8 forks source link

Issues that I can't seem to figure out #17

Closed rayzorben closed 9 months ago

rayzorben commented 9 months ago

I keep getting weird errors that don't make sense. Take for example this one that says unmatched OUTDENT. I have tried reindenting, deleting the line (which shifts the error to the next one). I have removed the whole block and it just shifts it to the id function

image

Or this one that I am missing a } which is clearly there

image
rayzorben commented 9 months ago

Here is some code that is causing a problem:


    getColorCodes: (input) ->
        colorPattern = /\x1B\[([0-9;]*)m/

        match = input.match colorPattern
        if match then match[1].split ';' else []

    handleCursor: (sequence) ->

The if statement which returns a value as an expression

image

If I restructure it as

 getColorCodes: (input) ->
        colorPattern = /\x1B\[([0-9;]*)m/

        match = input.match colorPattern
        result = if match then match[1].split ';' else []
        result

    handleCursor: (sequence) ->

it is fine.

rayzorben commented 9 months ago

one thing ive found is trailing spaces will cause issues

@keys = '' 

there is a trailing space there after '' and it will cause other errors in the file.

phil294 commented 9 months ago

That seems to be indeed all caused by some whitespace. Please read https://github.com/phil294/coffeesense#known-problems, especially the editor.trimAutoWhitespace paragraph