Coder Social home page Coder Social logo

Comments (16)

dsifford avatar dsifford commented on June 11, 2024 1

I think it's fine to accept PRs for this so long as it's wrapped in a has() condition (like other plugins we support)..

But for very specific customizations, I think it would be safer to customize down to the language level and not broadly...

So, for example.. Instead of @constructor.imported, maybe do @constructor.imported.javascript

from vim.

benknoble avatar benknoble commented on June 11, 2024 1

As I have said before, contributions are welcome in the form of PRs. This isn't something I use or even would be in a position to test (except that it doesn't break plain old Dracula on Vim).

Last I heard Derek was pretty busy, though he might be in a better position with respect to this feature now.

from vim.

benknoble avatar benknoble commented on June 11, 2024

What exactly is the request here?

  • We have some Treesitter support
  • #271 is closed with possible ways for users to resolve the discrepancy
  • the 'Additional Info' link doesn't explain the request

from vim.

I-Want-ToBelieve avatar I-Want-ToBelieve commented on June 11, 2024

Using LSP's semantic highlighting as a complement to Treesitter highlighting eliminates differences with VSCode highlighting.

When neovim is ready to provide LSP semantic tokens, the only thing the theme plugin needs to do is map LSP highlight groups to colors or highlight groups you like to actually see semantic highlights.

from vim.

benknoble avatar benknoble commented on June 11, 2024

Is that somehow different from https://github.com/dracula/vim/blob/master/colors/dracula.vim#L263-L275 ?

Is this something for which we need to monitor NeoVim releases to know when this feature stabilizes?

from vim.

benknoble avatar benknoble commented on June 11, 2024

(I think the answer to my first question is yes.)

from vim.

I-Want-ToBelieve avatar I-Want-ToBelieve commented on June 11, 2024

(I think the answer to my first question is yes.)

You are right, I quoted the previous question to illustrate what can be done next

from vim.

I-Want-ToBelieve avatar I-Want-ToBelieve commented on June 11, 2024

https://github.com/dracula/vim/blob/master/colors/dracula.vim#L263-L275 defines some mappings for LSP diagnostic highlight groups

The LSP semantic highlighting group is about the highlighting group of syntax tokens with different semantics

For example a mutable variable and a read-only constant variable can have different LSP highlight groups: LspVariable and LspVariableReadOnly. Thanks to this, we can map them with different colors, the final rendering effect of the theme is the same as VSCode

from vim.

benknoble avatar benknoble commented on June 11, 2024

Is this something for which we need to monitor NeoVim releases to know when this feature stabilizes?

This still needs addressed.

The LSP semantic highlighting group is about the highlighting group of syntax tokens with different semantics

For example a mutable variable and a read-only constant variable can have different LSP highlight groups: LspVariable and LspVariableReadOnly. Thanks to this, we can map them with different colors, the final rendering effect of the theme is the same as VSCode

Contributions welcome :)

from vim.

I-Want-ToBelieve avatar I-Want-ToBelieve commented on June 11, 2024

Is this something for which we need to monitor NeoVim releases to know when this feature stabilizes?

neovim/neovim#15723
Now there is a neovim plugin that implements LSP semantic highlighting, which can be used but may not be merged into NeoVim for a while

from vim.

I-Want-ToBelieve avatar I-Want-ToBelieve commented on June 11, 2024

I tried this plugin, and the effect is very good. It can be said that it is very close to the rendering effect of vscode, except for a few small flaws caused by the completely different syntax highlighting mechanism of treesitter and textmate

By customizing highlights.scm The final rendering effect is exactly the same as VSCode!

image

image

image

Highlight group mapping is easy:

use('dracula/vim', {
    disable: is_vscode,
    cond: can_load,
    as: 'dracula',
    config () {
      vim.cmd('colorscheme dracula')
      vim.cmd('hi! link LspParameter DraculaOrangeItalic')
      vim.cmd('hi! link LspVariableReadOnly DraculaPurple')
      vim.cmd('hi! link LspFunction DraculaGreen')
      vim.cmd('hi! link LspMember DraculaGreen')
      // vim.cmd('hi! link LspNamespace DraculaCyan')
      // vim.cmd('hi! link LspNamespaceDeclaration DraculaCyan')
      vim.cmd('hi! link LspProperty  Identifier')
      vim.cmd('hi! link LspEnumMember Identifier')
      // vim.cmd('hi! link LspClass DraculaCyan')
      vim.cmd('hi! link LspOperator DraculaPink')
      vim.cmd('hi! link @constructor.imported Identifier')
      vim.cmd('hi! link @namespace.imported Identifier')
      vim.cmd('hi! link @namespace.exported Identifier')
      vim.cmd('hi! link @variable.imported.specifier Identifier')
      vim.cmd('hi! link @operator.module DraculaPurple')
      // vim.cmd('hi! link @constructor.jsx DraculaCyanItalic')
      vim.cmd('hi! link @field Identifier')
    },
  })

But haven't tested other languages, there might be something to break

from vim.

benknoble avatar benknoble commented on June 11, 2024

I don't know what you mean by "customizing highlights.scm."

My major concern is that this appears to be an experimental plugin and not NeoVim coreβ€”I would be more comfortable waiting until the features land in NeoVim core.

What do you think @dsifford? I don't use NeoVim, so I don't know if my understanding of the situation is correct or not.

from vim.

I-Want-ToBelieve avatar I-Want-ToBelieve commented on June 11, 2024

customizing highlights.scm refers to https://github.com/nvim-treesitter/nvim-treesitter#adding-queries

from vim.

I-Want-ToBelieve avatar I-Want-ToBelieve commented on June 11, 2024

Given that this experimental plugin seems to be different from the LSP semantic highlighting specification, I can submit a PR about the LSP semantic highlighting group mapping after the plugin's author has dealt with it, and about the custom highlights.scm section, There is no definite specification, just record it here for the time being.

from vim.

ttytm avatar ttytm commented on June 11, 2024

Since semantic tokens support was merged (neovim/neovim#21100) dracula themes highlights break when the client attaches.

A 5 sec example using nvim nighlty, dracula and sumneko_lua as lsp:
After the client is loaded treesitter highlighting stops.

Sequence.1.mov

For now the way I found to go about is to nil the semanticTokensProvider when dracula is used or call vim.lsp.semantic_tokens.stop() for language server or to manually extend the highlight groups like @I-Want-ToBelieve describes above.

As it becomes harder to write good code without a dracula theme πŸ§›πŸ»β€β™‚οΈ,
do you have the chance to extend the themes highlighting to that @dsifford, @benknoble? 😊


Edit: just found we are already doing quite well, when just disabling semantic.keyword and semantic.variable

--- lsp/settings/sumneko_lua.lua
return {
	settings = {
		Lua = {
			-- ...
			semantic = {
				keyword = false,
				variable = false,
			},
			-- ...
		},
	},
}

from vim.

xiantang avatar xiantang commented on June 11, 2024

try https://github.com/xiantang/darcula-dark.nvim

from vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.