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? #1913

Open
Napoleon-Jm opened this issue Jan 6, 2025 · 10 comments
Open

Syntax Highlighting? #1913

Napoleon-Jm opened this issue Jan 6, 2025 · 10 comments
Labels
enhancement New feature or request

Comments

@Napoleon-Jm
Copy link

When I want to use "tokenColorCustomizations" to define a color for swift, I found the syntax is not supported very well.

E.g.
The class property name and property type be recognoized the same type token?
Property name:
image
Property type:
image

the type and the name are both meta.definition.type.body.swift and meta.definition.type.class.swift

There is some other not supported too, as the function param and function call param, and so on.

Can we supported for syntax highlighting for swift?

@plemarquand
Copy link
Contributor

I tried to reproduce but the only case where CBUUID isn't highlighted is when the type cannot be found. Defining struct CBUUID {} highlights it as expected. Are you able to right click on CBUUID and select Go To Definition?

Screenshot 2025-01-06 at 9 26 05 AM

@Napoleon-Jm
Copy link
Author

Napoleon-Jm commented Jan 7, 2025

I tried to reproduce but the only case where CBUUID isn't highlighted is when the type cannot be found. Defining struct CBUUID {} highlights it as expected. Are you able to right click on CBUUID and select Go To Definition?

Screenshot 2025-01-06 at 9 26 05 AM

Yes it can "Go To Definition", the CBUUID is system library class from CoreBluetooth. @plemarquand

Even the NSNumber is the same effect:
image

@plemarquand
Copy link
Contributor

Could you provide some diagnostics information by:

  1. Closing all files except except one that isn't syntax highlighting correctly
  2. Close VS Code
  3. Reopen VS Code
  4. Run the > Swift: Capture VS Code Diagnostic Bundle command, choosing Full Diagnostics
  5. Zip and attach the resulting files to this GitHub issue.

@Napoleon-Jm
Copy link
Author

Could you provide some diagnostics information by:

  1. Closing all files except except one that isn't syntax highlighting correctly
  2. Close VS Code
  3. Reopen VS Code
  4. Run the > Swift: Capture VS Code Diagnostic Bundle command, choosing Full Diagnostics
  5. Zip and attach the resulting files to this GitHub issue.

@plemarquand
diagnoistics.zip

@plemarquand
Copy link
Contributor

Nothing is jumping out at me in the diagnostics, however the relevant responses from the LSP are redacted to protect privacy. If you're comfortable having source code and file paths included in the diagnostics you can enable extended logging in sourcekit-lsp and run another diagnose.

Regardless, since the VS Code extension has its syntax highlighting provided by sourcekit-lsp I'm going to transfer this issue to that repo.

@plemarquand plemarquand transferred this issue from swiftlang/vscode-swift Jan 8, 2025
@ahoppen
Copy link
Member

ahoppen commented Jan 8, 2025

Looks like we might not have build settings for a file, the logs show Producing syntactic diagnostics from the built-in swift-syntax because we have fallback build settings. If you could enable extended logging, open the file, do a jump-to-definition on CBUUID and then capture another diagnose, that should help us figure out what’s going wrong.

@ahoppen
Copy link
Member

ahoppen commented Jan 8, 2025

Synced to Apple’s issue tracker as rdar://142560819

@Napoleon-Jm
Copy link
Author

Napoleon-Jm commented Jan 9, 2025

Looks like we might not have build settings for a file, the logs show Producing syntactic diagnostics from the built-in swift-syntax because we have fallback build settings. If you could enable extended logging, open the file, do a jump-to-definition on CBUUID and then capture another diagnose, that should help us figure out what’s going wrong.

not only the built-in class or struct like CBUUID, but also my custom class is not work nether.
image

image

@ahoppen
Copy link
Member

ahoppen commented Jan 9, 2025

If you could enable extended logging, open the file, do a jump-to-definition on CBUUID and then capture another diagnose, that should help us figure out what’s going wrong.

If you could do those steps, that would really help us determine what’s going wrong.

@jerryjefit
Copy link

jerryjefit commented Feb 5, 2025

Not fully sure how the scopes work, but I noticed that it depends on the theme I have selected for what scopes show up in this debug menu.

Here is Dark+ for a variable and its type

@Napoleon-Jm Can you let me know what theme you are using?

Image
Image

Here is the same variable and type for Xcode dark theme (from the marketplace)

Image
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants