Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_ is treated as word syntax rather than symbol syntax #431

Open
darkfeline opened this issue Nov 24, 2023 · 1 comment · May be fixed by #432
Open

_ is treated as word syntax rather than symbol syntax #431

darkfeline opened this issue Nov 24, 2023 · 1 comment · May be fixed by #432

Comments

@darkfeline
Copy link

darkfeline commented Nov 24, 2023

Read comments for context.

Old title: Syntax highlighting doesn't support _ in named return

Old description:

The syntax highlighting fails on the _ in cases like:

func getPort() (port int, _ error) {
    // do stuff
}
@darkfeline
Copy link
Author

darkfeline commented Nov 24, 2023

This is the same bug that causes _ in test function names to fail syntax highlighting. Identifiers are [:word:] and _ is not marked as a word syntax class I think.

Edit: _ is marked as word syntax but somehow it still doesn't work.

(defvar go-mode-syntax-table
  (let ((st (make-syntax-table)))
    ;; snip
    ;; TODO make _ a symbol constituent now that xemacs is gone
    (modify-syntax-entry ?_  "w" st)

    st)
  "Syntax table for Go mode.")

Changing [[:word:][:multibyte:]] in the various regexps to [[:word:]_[:multibyte:]] does fix the issue.

Edit 2: I'm an idiot, I set _ back to symbol syntax in my personal config. However, noting the TODO I quoted above, this will (?) eventually need to be fixed.

@darkfeline darkfeline changed the title Syntax highlighting doesn't support _ in named return Syntax highlighting doesn't support _ in identifiers Nov 24, 2023
@darkfeline darkfeline changed the title Syntax highlighting doesn't support _ in identifiers _ is treated as word syntax rather than symbol syntax Nov 24, 2023
darkfeline added a commit to darkfeline/go-mode.el that referenced this issue Nov 24, 2023
And fix all of the regexps accordingly.

Fixes dominikh#431
@darkfeline darkfeline linked a pull request Nov 24, 2023 that will close this issue
JasZhe pushed a commit to JasZhe/go-mode.el that referenced this issue Sep 12, 2024
And fix all of the regexps accordingly.

Fixes dominikh#431
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant