Skip to content

Commit 327faf4

Browse files
committed
gdscript: allow color picking
Implement `DocumentColorProvider` by extracting Color expressions, interpreting them, and replacing arguments in place when possible.
1 parent 38c9a88 commit 327faf4

File tree

6 files changed

+775
-3
lines changed

6 files changed

+775
-3
lines changed

package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,21 @@
375375
"type": "boolean",
376376
"default": true,
377377
"description": "Whether to enable inlay hints in GDResource (.tscn, .tres, etc) files"
378+
},
379+
"godotTools.colorPicker.precision": {
380+
"type": "integer",
381+
"default": 3,
382+
"description": "Amount of decimals to include when using the color picker. 0 for arbitrary precision."
383+
},
384+
"godotTools.colorPicker.padValues": {
385+
"type": "boolean",
386+
"default": false,
387+
"description": "Write either 1.2 (unpadded) or either 1.200 (padded)."
388+
},
389+
"godotTools.colorPicker.uppercaseHex": {
390+
"type": "boolean",
391+
"default": false,
392+
"description": "Write either 0x008b8bff or either 0x008B8BFF."
378393
}
379394
}
380395
},

src/extension.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { attemptSettingsUpdate, get_extension_uri, clean_godot_path } from "./ut
55
import {
66
GDInlayHintsProvider,
77
GDHoverProvider,
8+
GDDocumentColorProvider,
89
GDDocumentDropEditProvider,
910
GDDocumentLinkProvider,
1011
GDSemanticTokensProvider,
@@ -37,6 +38,7 @@ interface Extension {
3738
lsp?: ClientConnectionManager;
3839
debug?: GodotDebugger;
3940
scenePreviewProvider?: ScenePreviewProvider;
41+
colorProvider?: GDDocumentColorProvider;
4042
linkProvider?: GDDocumentLinkProvider;
4143
dropsProvider?: GDDocumentDropEditProvider;
4244
hoverProvider?: GDHoverProvider;
@@ -58,6 +60,7 @@ export function activate(context: vscode.ExtensionContext) {
5860
globals.lsp = new ClientConnectionManager(context);
5961
globals.debug = new GodotDebugger(context);
6062
globals.scenePreviewProvider = new ScenePreviewProvider(context);
63+
globals.colorProvider = new GDDocumentColorProvider(context);
6164
globals.linkProvider = new GDDocumentLinkProvider(context);
6265
globals.dropsProvider = new GDDocumentDropEditProvider(context);
6366
globals.hoverProvider = new GDHoverProvider(context);
@@ -101,14 +104,14 @@ async function initial_setup() {
101104
break;
102105
}
103106
case "WRONG_VERSION": {
104-
const message = `The specified Godot executable, '${godotPath}' is the wrong version.
107+
const message = `The specified Godot executable, '${godotPath}' is the wrong version.
105108
The current project uses Godot v${projectVersion}, but the specified executable is Godot v${result.version}.
106109
Extension features will not work correctly unless this is fixed.`;
107110
prompt_for_godot_executable(message, settingName);
108111
break;
109112
}
110113
case "INVALID_EXE": {
111-
const message = `The specified Godot executable, '${godotPath}' is invalid.
114+
const message = `The specified Godot executable, '${godotPath}' is invalid.
112115
Extension features will not work correctly unless this is fixed.`;
113116
prompt_for_godot_executable(message, settingName);
114117
break;

0 commit comments

Comments
 (0)