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

Add comment syntax highlighting support #9082

Closed
wants to merge 10 commits into from
Closed

Conversation

d1y
Copy link
Contributor

@d1y d1y commented Mar 8, 2024

From zed-industries/extensions#523 & #6013

Before:

image

After:

image

AFAIK: The #7826 will it conflict with this? Now. It only works with JS single comment

Refer to helix: helix-editor/helix#2763 (See helix-editor/helix#2650)

The label color need overridden it

The syntax in the theme doesn't actually have these colors, is it missing here? @iamnbutler

  • hint
  • info
  • error
  • warning

Sample configuration, add it to settings.json yourself:

{
	"experimental.theme_overrides": {
	    "syntax": {
	      "hint": {
	        "color": "#576cdbff",
	        "font_style": "italic",
	        "font_weight": 700
	       },
	       "info": {
	         "color": "#36a165ff",
	         "font_style": "oblique",
	         "font_weight": 700
	       },
	       "error": {
	         "color": "#d73837ff",
	         "font_style": "oblique",
	         "font_weight": 700
	       },
	       "warning": {
	         "color": "#ae9414ff",
	         "font_style": "italic",
	         "font_weight": 700
	       }
	    }
	}
}

This PR injects some commonly used languages

  • bash
  • css
  • dart
  • go
  • gomod
  • gowork
  • html
  • javascript
  • json
  • lua
  • python
  • ruby
  • rust
  • toml
  • typescript(tsx)
  • vue
  • yaml
  • dockerfile

Dockerfile extension not added: https://github.com/d1y/dockerfile.zed/blob/master/languages/dockerfile/injections.scm

Release Notes:

  • Added comment syntax highlighting support

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 8, 2024
@d1y
Copy link
Contributor Author

d1y commented Mar 8, 2024

I don’t know how to fall back to the extension yet. I haven’t seen any examples of related inject syntax. I think at this time, it is more appropriate to build it into zed-core :)

@d1y
Copy link
Contributor Author

d1y commented Mar 8, 2024

There is a small problem, we can add a @link_uri || @link_text an underscore?

I know that underline can now be displayed on "cmd" + hover

The VScode:

image

@d1y
Copy link
Contributor Author

d1y commented Mar 9, 2024

I'm wondering, does this need to be injected into all languages ​​in some way, or is it injected one by one like this🤔?
@SomeoneToIgnore @maxbrunsfeld @maxdeviant

image

I only support programming languages ​​that I think are commonly used

@d1y d1y force-pushed the todo branch 2 times, most recently from 767f227 to 3f360df Compare March 9, 2024 10:07
@d1y
Copy link
Contributor Author

d1y commented Mar 9, 2024

@d1y d1y changed the title WIP: add comment(TODO/FIXME) support Add comment support Mar 9, 2024
@d1y d1y changed the title Add comment support Add comment syntax highlighting support Mar 9, 2024
@d1y d1y marked this pull request as ready for review March 9, 2024 12:20
@maxdeviant
Copy link
Member

I think this is the sort of thing that should be provided by an extension.

Although I think we’ll have to work out how to have extensions provide injections for languages that aren’t in the same extension.

@maxdeviant maxdeviant self-assigned this Mar 9, 2024
@maxdeviant
Copy link
Member

Going to close this, for now. At some point we can implement it in an extension, as we build out the extension capabilities.

@maxdeviant maxdeviant closed this Mar 14, 2024
@0x2CA 0x2CA mentioned this pull request Apr 15, 2024
1 task
@inoas
Copy link

inoas commented Apr 26, 2024

This would be lovely to have!

@Module32
Copy link

Module32 commented Aug 30, 2024

+1, would love to see this. Any updates?

@g0t4
Copy link
Contributor

g0t4 commented Sep 1, 2024

@maxdeviant yeah extension makes sense... what features are missing in the extension APIs that are blocking doing that? Is the issue doing this in a way that doesn't need to extend each language one by one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants