Comments (6)
This is incorrect @AthirsonSilva
- this is using utilities in
LazyVim
which aren't available in AstroNvim - Semantic tokens are default in 0.9+ so you don't need to enable the capability.
All you need to do is create a file user/lsp/config/gopls.lua
and give it the content:
return {
settings = {
gopls = {
semanticTokens = true,
},
},
}
from astrotheme.
Looks like semantic tokens are disabled by default. It will be up to the treesitter parser or the language server to provide semantic tokens for them to be highlighted nicely. Syntax is controlled in a general level and not necessarily language specific
from astrotheme.
You probably just need to configure gopls to enable semantic tokens in the settings to get better highlighting
from astrotheme.
Oh, then i will take a look at it, many thanks!
from astrotheme.
I don't know if reopening this issue or making a new post on the Discord would be the correct way, but i tried configuring gopls to enable semantic tokens and it didn't work, here goes my init.lua file:
return {
opts = {
clipboard = "unnamedplus",
setup = {
gopls = function(_, opts)
require("lazyvim.util").on_attach(function(client, bufnr)
if client.name == "gopls" then
client.server_capabilities.semanticTokens = {
full = true,
legend = {
tokenTypes = {
"namespace",
"type",
"class",
"enum",
"interface",
"struct",
"typeParameter",
"parameter",
"variable",
"property",
"enumMember",
"event",
"function",
"method",
"macro",
"keyword",
"modifier",
"comment",
"string",
"number",
"regexp",
"operator",
"decorator",
},
tokenModifiers = {
"declaration",
"definition",
"readonly",
"static",
"deprecated",
"abstract",
"async",
"modification",
"documentation",
"defaultLibrary",
},
},
}
end
end)
opts.settings = {
gopls = {
semanticTokens = true,
},
}
end,
},
},
highlights = {
init = {},
},
plugins = {
"gbprod/cutlass.nvim",
"AstroNvim/astrocommunity",
{ import = "astrocommunity.motion.mini-move" },
{ import = "astrocommunity.project.nvim-spectre" },
{ import = "astrocommunity.project.projectmgr-nvim" },
},
mappings = {
-- first key is the mode
n = {
-- second key is the lefthand side of the map
-- mappings seen under group name "Buffer"
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
["<leader>bD"] = {
function()
require("astronvim.utils.status").heirline.buffer_picker(
function(bufnr) require("astronvim.utils.buffer").close(bufnr) end
)
end,
desc = "Pick to close",
},
-- tables with the `name` key will be registered with which-key if it's installed
-- this is useful for naming menus
["<leader>b"] = { name = "Buffers" },
-- quick save
["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
["d"] = { '"_d', desc = "Deletes current line without copying the contents" },
-- ["<Del>"] = { '"_d', desc = "Delete visual selection without saving to clipboard" },
},
v = {
-- setting a mapping to false will disable it
-- ["<esc>"] = false,
["<Del>"] = { '"_d', desc = "Delete visual selection without saving to clipboard" },
},
},
}
I found this configuration on this Reddit post: https://www.reddit.com/r/neovim/comments/11xekjx/how_to_make_semantic_token_highlighting_work_with/
One interesting thing is that in the post it was mentioned that semantic tokens are built into neovim now, and i am already using a recent version of neovim right now, and since the link @mehalter posted was from 2022, it makes sense to be built in now.
That is also this post that says the same thing: https://www.reddit.com/r/neovim/comments/zg6bvs/lsp_semantic_tokens_support_merged/
NVIM v0.10.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Run "nvim -V1 -v" for more info
from astrotheme.
here is an example with just that added in a base AstroNvim install.
from astrotheme.
Related Issues (20)
- Floats blend with main window (no borders or different bg color) HOT 13
- Normal and highlight colors swapped HOT 4
- Is `crust` a bit too warm for this cool theme? HOT 6
- Theme does not apply after installing with packer HOT 7
- Feature Request - Monochrome palette HOT 2
- Value of italic_comments not respected HOT 4
- Update images on README HOT 1
- Highlight group modifications don't persist after reloading colorschemes HOT 2
- lazygit color HOT 4
- Global highlight customizations not working on v2.2.0 HOT 4
- Contrast issue with light theme HOT 5
- Brackets not highlighted HOT 6
- Previous dark colorscheme HOT 3
- Current buffer highlight group? HOT 4
- No Highlight colors? HOT 5
- Loading a palette which is not in the config table crashes HOT 4
- zsh autosuggestions text color is overridden in terminal buffer HOT 1
- Changes to astrotheme don't apply. HOT 2
- Neogit support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from astrotheme.