Skip to content

Last character missing in auto-suggest in ST4 #251

Closed
@taneltm

Description

@taneltm

In CoffeeScript classes, when accessing class members with the @ shorthand, the suggestion is missing the last character.
If I recall correctly, this was working properly in ST3.

image

Activity

gtarawneh

gtarawneh commented on Jul 6, 2022

@gtarawneh

I'm facing the same issue (with all functions actually, not just class methods).

After a bit of digging into my CoffeeScript.tmLanguage I narrowed it down to this section ...

<dict>
    <key>captures</key>
    <dict>
        <key>2</key>
        <dict>
            <key>name</key>
            <string>entity.name.function.coffee</string>
        </dict>
        <key>3</key>
        <dict>
            <key>name</key>
            <string>entity.name.function.coffee</string>
        </dict>
        <key>4</key>
        <dict>
            <key>name</key>
            <string>variable.parameter.function.coffee</string>
        </dict>
        <key>5</key>
        <dict>
            <key>name</key>
            <string>storage.type.function.coffee</string>
        </dict>
    </dict>
    <key>match</key>
    <string>(?x)
        (\s*)
        (?=[a-zA-Z\$_@])
        (
            [a-zA-Z\$_@](\w|\$|:|\.)*\s*
            (?=[:=]( (\s*.\( ($)) | (\s*\(.*\) )?\s*([=-]&gt;)))
        )
    </string>
    <key>name</key>
    <string>meta.function.coffee</string>
</dict>

I don't know tmLanguage syntax but it looks like the 2nd and 3rd capture groups in the unwieldy regex at the bottom are being assigned the name entity.name.function.coffee which narrowed down my blind fiddling efforts.

Workaround (warning: no clue why or how this works 😅)

I found out that deleting the following part seems to resolve to issue ...

<key>3</key>
<dict>
    <key>name</key>
    <string>entity.name.function.coffee</string>
</dict>

although I'm not sure if it fixes an issue with the syntax file or with ST4 itself (I don't recall facing the issue in ST3, even though I was using the same syntax file).

I can't see any immediate impact in terms of syntax coloring (will post any updates here), and now I get correct autocomplete for function names.

If anyone understands why the edit above works please let me know. 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @gtarawneh@taneltm

        Issue actions

          Last character missing in auto-suggest in ST4 · Issue #251 · SublimeText/CoffeeScript