You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[feature request] disable semantic colouring by default #3419
Who would have thought that a language server could actually affect syntax highlighting?
Who would have thought that a language server would actually make keywords and comments the same color?
My understanding of language server is very shallow, but I understand that lang server does not change the syntax highlighting, but only changes the type of the token.
For vscode, the default is textmate (regex method?) to determine the token type, which may not be accurate.
The language server will return semantic type after "understanding" the code, which should be more accurate in theory.
I just tried qt creator editor and I did have this problem. . .
But everything works fine on vscode
My personal guess is that Qt creator cannot handle semantic token type 😇
This is a very classic cross-editor syntax parsing conflict problem.
Simply put, this phenomenon occurs because Qt Creator's mechanism for processing "grammar tags" is not as smart as VS Code, resulting in a gap between the two in interpreting the data returned by the Lua Language Server (LSP).
Here's the underlying reason why turning it off works, and why VS Code is fine:
1. What is Semantic Highlighting?
Traditional code colors (such as those built into Qt Creator) rely solely on regular expressions (TextMate syntax rules). It only looks at the literals. For example, it will be colored blue when it sees function, and it will be colored green when it sees double quotes "".
When the language server (lua-language-server) turns on semantic highlighting, it will read the code into memory for complete "in-depth analysis", and then pass a bunch of special Tokens (tags) to the editor, for example: "The third word on line 5 is a global variable", "Line 10 is a custom function". [1]
2. Why does Qt Creator get "messed up"?
When Qt Creator receives these advanced tags, it will try to map these tags to the editor theme color (Color Theme) you are currently using. [1]
The problem lies here:
Label mapping failure (Mapping Gap): Lua LSP throws out a lot of Lua-specific semantic labels, but the built-in theme of Qt Creator does not define what color these labels should be at all. [1, 2]
Forced override (Fallback error): When Qt Creator does not know what color to add, it will not "keep the original color" smartly. Instead, it will often use the default pure text color (such as all white or all black) to directly override the original good color (Override), causing the color of the entire screen to become very strange or even pale. [3]
When you set "semantic.enable": false, you tell the Lua server not to send these advanced tags, and Qt Creator will revert to the original static rules, and the colors will naturally return to normal.
3. Why does VS Code open normally?
VS Code is the biological parent (developed by Microsoft) of LSP (Language Server Protocol), and it has extremely high support for this mechanism:
Perfect semantic mapping table: VS Code’s theme system is very mature. When Lua LSP passes a special Token (such as variable.lua), VS Code has a powerful fallback mechanism (Fallback hierarchy). If the theme does not define this special Lua variable color, it will automatically downgrade to use the color of the general variable variable and will never directly erase the color. [2]
Special plug-in optimization: You usually install special Lua extension kits in VS Code. These kits have helped you manually align all the semantic tags of lua-language-server with VS Code's major popular themes. However, Qt Creator's Language Client is still relatively generic and crude at this stage, lacking such fine tuning for a single language. [4]
Summary
This is not the Lua server's fault, but Qt Creator's LSP client's handling of "semantic tag color conversion" is not perfect enough. Turning it off in Qt Creator, focusing on letting the server handle "jumping, auto-completion", and leaving "painting colors" to the IDE itself is the most flexible and worry-free approach. [1]
If you want to tweak it further, I can share it with you:
How to manually expand Lua's MIME type in Qt Creator
How to check what data is sent by the server in the Inspect Language Clients window built into Qt Creator [5]
Activity
tomlau10 commentedon Jun 13, 2026
你可能是查了 github 上的舊 wiki?
目前來說這個字段預設是打開的
https://luals.github.io/wiki/settings/#semanticenable
我對 language server 的了解很淺,但我理解 lang server 並非改變語法高亮,只是改變了 token 的
type我剛試了下 qt creator editor,確實有這問題。。。
但 vscode 上一切正常的
我個人猜測是 Qt creator 無法處理 semantic token type 😇
以下是 google ai mode 的回覆
https://share.google/aimode/TzE2O3ychHp8XzGAk
toggle
這是一個非常經典的跨編輯器語法解析衝突問題。
簡單來說,會造成這種現象,是因為 Qt Creator 處理「語法標籤」的機制沒有 VS Code 那麼聰明,導致兩者在解讀 Lua 語言伺服器(LSP)傳回來的資料時出現了落差。
以下是為什麼關掉它就正常,以及為什麼 VS Code 沒事的底層原因:
1. 什麼是 Semantic Highlighting(語意高亮)?
傳統的代碼顏色(如 Qt Creator 內建的)只靠正則表達式(TextMate 語法規則)。它只看字面,例如看到 function 就塗藍色,看到雙引號 "" 就塗綠色。
而語言伺服器(lua-language-server)開啟語意高亮後,會把代碼讀進記憶體做完整的「深度分析」,然後傳給編輯器一堆特殊的 Tokens(標籤),例如:「第 5 行第 3 個字是一個全域變數」、「第 10 行是一個自訂函式」。 [1]
2. 為什麼 Qt Creator 會「亂掉」?
當 Qt Creator 收到這些高級標籤時,它會試圖把這些標籤對應到你目前使用的編輯器主題顏色(Color Theme)。 [1]
問題就出在這裡:
當你設定 "semantic.enable": false 後,就是叫 Lua 伺服器不要再傳這些高級標籤過來,Qt Creator 就乖乖用回原本的靜態規則,顏色自然就恢復正常了。
3. 為什麼 VS Code 打開都正常?
VS Code 是 LSP(語言伺服器協定)的親生父母(微軟開發),它對這套機制的支援度極高:
總結
這不是 Lua 伺服器的錯,而是 Qt Creator 的 LSP 客戶端在處理「語意標籤顏色轉換」時不夠完善。在 Qt Creator 裡關掉它、專心讓伺服器處理「跳轉、自動補全」,把「畫顏色」留給 IDE 自己,是最靈巧也最省心的做法。 [1]
如果想進一步調整,我可以和您分享:
[1] [https://github.com/](eclipse-lsp4e/lsp4e#821)
[2] [https://www.reddit.com](https://www.reddit.com/r/neovim/comments/11l5msb/anyone_got_their_syntax_highlighting_messed_up/)
[3] [https://github.com/](microsoft/pylance-release#7959)
[4] [https://doc.qt.io](https://doc.qt.io/qtcreator/creator-language-servers.html)
[5] [https://docs.huihoo.com](https://docs.huihoo.com/qt/qtcreator/10.x/creator-language-servers.html)
luals 本身也只說明針對 vscode 的 (?) 所以其他 editor 出錯的話,估計不會因此處理
PS: 我只是 contributor 不是 maintainer
Issues-translate-bot commentedon Jun 13, 2026
Maybe you checked the old wiki on github?
Currently, this field is turned on by default
https://luals.github.io/wiki/settings/#semanticenable
My understanding of language server is very shallow, but I understand that lang server does not change the syntax highlighting, but only changes the
typeof the token.I just tried qt creator editor and I did have this problem. . .
But everything works fine on vscode
My personal guess is that Qt creator cannot handle semantic token type 😇
The following is the reply from google ai mode
https://share.google/aimode/TzE2O3ychHp8XzGAk
toggle
This is a very classic cross-editor syntax parsing conflict problem.
Simply put, this phenomenon occurs because Qt Creator's mechanism for processing "grammar tags" is not as smart as VS Code, resulting in a gap between the two in interpreting the data returned by the Lua Language Server (LSP).
Here's the underlying reason why turning it off works, and why VS Code is fine:
1. What is Semantic Highlighting?
Traditional code colors (such as those built into Qt Creator) rely solely on regular expressions (TextMate syntax rules). It only looks at the literals. For example, it will be colored blue when it sees function, and it will be colored green when it sees double quotes "".
When the language server (lua-language-server) turns on semantic highlighting, it will read the code into memory for complete "in-depth analysis", and then pass a bunch of special Tokens (tags) to the editor, for example: "The third word on line 5 is a global variable", "Line 10 is a custom function". [1]
2. Why does Qt Creator get "messed up"?
When Qt Creator receives these advanced tags, it will try to map these tags to the editor theme color (Color Theme) you are currently using. [1]
The problem lies here:
When you set "semantic.enable": false, you tell the Lua server not to send these advanced tags, and Qt Creator will revert to the original static rules, and the colors will naturally return to normal.
3. Why does VS Code open normally?
VS Code is the biological parent (developed by Microsoft) of LSP (Language Server Protocol), and it has extremely high support for this mechanism:
Summary
This is not the Lua server's fault, but Qt Creator's LSP client's handling of "semantic tag color conversion" is not perfect enough. Turning it off in Qt Creator, focusing on letting the server handle "jumping, auto-completion", and leaving "painting colors" to the IDE itself is the most flexible and worry-free approach. [1]
If you want to tweak it further, I can share it with you:
[1] [https://github.com/](eclipse-lsp4e/lsp4e#821)
[2] [https://www.reddit.com](https://www.reddit.com/r/neovim/comments/11l5msb/anyone_got_their_syntax_highlighting_messed_up/)
[3] [https://github.com/](microsoft/pylance-release#7959)
[4] [https://doc.qt.io](https://doc.qt.io/qtcreator/creator-language-servers.html)
[5] [https://docs.huihoo.com](https://docs.huihoo.com/qt/qtcreator/10.x/creator-language-servers.html)
luals itself only specifies (?) for vscode, so if other editors make errors, they probably won’t be dealt with accordingly.
PS: I am just a contributor, not a maintainer
iamqiz commentedon Jun 13, 2026
@tomlau10 谢谢您之前的回复我才解决了问题!
我说的默认关闭的是 semantic.keyword 这个,
既然默认关闭,我也没开启,且vscode 正常.那么导致 关键词和注释一样颜色的原因可能真是你说的"無法處理 semantic token type",
或者可能是qt creator插件没处理好 LS返回的数据 (插件版本才1.0.0 😅)
tomlau10 commentedon Jun 13, 2026
🙈 喔~ 不好意思我看錯了
嗯~ 暫時最有可能的解釋,是 qt creator 不支持 semantic token type 🫠