From 0a5e8fd0da39fdc13e963f79023803c68db74829 Mon Sep 17 00:00:00 2001 From: Florian Loitsch Date: Thu, 10 Aug 2023 16:11:26 +0200 Subject: [PATCH] Improve "word" experience in vscode. (#225) The model (form language-configuration.json) accepts '-' as long as it is surrounded by '\w'. However, the editor still uses '-' as word boundary. This combination sounds counter-intuitive, but works okish with highlighting: the model is used to find the initial word, and the editor then finds "whole" words by using the separators. This means that `--foo-bar` finds other `foo-bar`s (and, more importantly, `foo-bar` also finds `--foo-bar`). However, it also means that `foo-bar-gee` will now also be highlighted for the `foo-bar` part. A correct solution will use the LSP, which can provide a good list of the identifiers that are relevant. (Initially maybe just all identifiers that would match). --- vscode/language-configuration.json | 2 +- vscode/package.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/vscode/language-configuration.json b/vscode/language-configuration.json index 811a377..2293a59 100644 --- a/vscode/language-configuration.json +++ b/vscode/language-configuration.json @@ -28,7 +28,7 @@ ["\"", "\""], ["'", "'"] ], - "wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s\\$]+)", + "wordPattern": "(-?\\d*\\.\\d\\w*)|(\\w(-?\\w)*)", "indentationRules": { "increaseIndentPattern": "[\\:]([\\s]*\\|(\\s*[\\w-]+)+\\s*\\|)?$", "decreaseIndentPattern": "^[\\s]*else[\\:]$" diff --git a/vscode/package.json b/vscode/package.json index ab1afe2..d8c1b3b 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -26,7 +26,6 @@ "contributes": { "configurationDefaults": { "[toit]": { - "editor.wordSeparators": "`~!@#$%^&*()=+[{]}\\|;:'\",.<>/?", "editor.indentSize": 2, "editor.insertSpaces": true, "editor.detectIndentation": false