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

Syntax highlighting: Functions with capital first letter incorrectly colored as types #17880

Open
1 task done
colinlienard opened this issue Sep 16, 2024 · 1 comment
Open
1 task done
Labels
defect [core label] typescript TypeScript programming language support

Comments

@colinlienard
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

When writing a function name that starts with a capital letter in the editor, the syntax highlighter incorrectly identifies it as a type instead of a function. This results in the wrong color being applied to the function name, which is a bit confusing especially when using React.

This is not a theme specific issue, the bug occurs with all the themes.

Reproduction

Create a typescript file and paste this:

type ThisIsAType = {
	foo: 'bar';
};

function thisIsAFunction() {
	return 42;
}

// Same color as the type instead of the function
function ThisIsAFunctionNotAType() {
	return 42;
}

Environment

Zed: v0.152.3 (Zed)
OS: macOS 14.6.1
Memory: 16 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

image

If applicable, attach your Zed.log file to this issue.

No response

@colinlienard colinlienard added admin read Pending admin review defect [core label] triage Maintainer needs to classify the issue labels Sep 16, 2024
@notpeter notpeter added typescript TypeScript programming language support and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Sep 16, 2024
@notpeter
Copy link
Member

Tree-sitter parses these identically ("debug: open syntax tree view" from the command palette) so I'm not sure where this getting mixed up, but I can reproduce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect [core label] typescript TypeScript programming language support
Projects
None yet
Development

No branches or pull requests

2 participants