mirror of
https://github.com/godotengine/godot-vscode-plugin.git
synced 2026-01-01 17:48:36 +03:00
Compare commits
61 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e344cdf2fc | ||
|
|
a116454b5a | ||
|
|
94e5a9e95d | ||
|
|
372936b606 | ||
|
|
ad7665f35f | ||
|
|
9ea9ce0915 | ||
|
|
13bd54d2fe | ||
|
|
7b49c4b3e8 | ||
|
|
588df8fd93 | ||
|
|
f860020c63 | ||
|
|
1d76541f04 | ||
|
|
fb96098c70 | ||
|
|
0835506157 | ||
|
|
2cfbed2dad | ||
|
|
5e0d108953 | ||
|
|
78e37e8016 | ||
|
|
547b92ad80 | ||
|
|
4ac06a7691 | ||
|
|
d404eaedc6 | ||
|
|
854ec42027 | ||
|
|
281c78f133 | ||
|
|
a254b55aa5 | ||
|
|
1be4ccaaad | ||
|
|
1755e2f3c3 | ||
|
|
f9a5204dcf | ||
|
|
62cb49e506 | ||
|
|
c347a522a3 | ||
|
|
293cc8c1fb | ||
|
|
f21d7517c4 | ||
|
|
314288b592 | ||
|
|
c3c615825d | ||
|
|
6ebc866ce1 | ||
|
|
fb498a7502 | ||
|
|
ee80ea914b | ||
|
|
158c0c38bf | ||
|
|
f1e57e5443 | ||
|
|
e78a8b8f86 | ||
|
|
c03ab7e3f5 | ||
|
|
12858a2e05 | ||
|
|
355c0f8614 | ||
|
|
650170ce13 | ||
|
|
1b358fadec | ||
|
|
20dc0445c3 | ||
|
|
1a932d5283 | ||
|
|
975acd7aa4 | ||
|
|
1ec75dc622 | ||
|
|
6fe93c9c6b | ||
|
|
363160ee3b | ||
|
|
9fa3031699 | ||
|
|
ce30e6ed95 | ||
|
|
2364664f7a | ||
|
|
21cfd82f4d | ||
|
|
29f1bc0ceb | ||
|
|
338b6ae977 | ||
|
|
71a4a0420d | ||
|
|
383dcc9507 | ||
|
|
5c5c19b534 | ||
|
|
91da651444 | ||
|
|
f2a6288276 | ||
|
|
a8872c2e56 | ||
|
|
e9f674d9e7 |
71
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
71
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
name: Bug report
|
||||
description: Report a bug in Godot Tools VS Code add-on
|
||||
labels:
|
||||
- bug
|
||||
body:
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
- Write a descriptive issue title above.
|
||||
- Search [open](https://github.com/godotengine/godot-vscode-plugin/issues) and [closed](https://github.com/godotengine/godot-vscode-plugin/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported.
|
||||
- Verify that you are using a [supported Godot version](https://docs.godotengine.org/en/stable/about/release_policy.html).
|
||||
- This repository only contains the LSP *client*. Issues pertaining to the Godot editor itself or the LSP's *server* side should be reported on the [main Godot repository](https://github.com/godotengine/godot/issues).
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Godot version
|
||||
description: >
|
||||
Specify the Git commit hash if using a development or non-official build.
|
||||
If you use a custom build, please test if your issue is reproducible in official builds too.
|
||||
placeholder: 3.3.stable, 4.0.dev (3041becc6)
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: VS Code version
|
||||
description: >
|
||||
Use the **Help > About** menu to see your current version.
|
||||
Specify the Git commit hash if using a development or non-official build.
|
||||
If you use a custom build, please test if your issue is reproducible in official builds too.
|
||||
placeholder: "1.64.2"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Godot Tools VS Code extension version
|
||||
description: >
|
||||
Open the **Extensions** side panel and click on the **godot-tools** extension to see your current version.
|
||||
Specify the Git commit hash if using a development or non-official build.
|
||||
If you use a custom build, please test if your issue is reproducible in official builds too.
|
||||
placeholder: "1.3.1"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: System information
|
||||
description: |
|
||||
Specify the OS version, and when relevant hardware information.
|
||||
placeholder: Windows 10
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Issue description
|
||||
description: |
|
||||
Describe your issue briefly. What doesn't work, and how do you expect it to work instead?
|
||||
You can include images or videos with drag and drop, and format code blocks or logs with <code>```</code> tags.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: |
|
||||
List of steps or sample code that reproduces the issue. Having reproducible issues is a prerequisite for contributors to be able to solve them.
|
||||
validations:
|
||||
required: true
|
||||
6
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
6
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
blank_issues_enabled: false
|
||||
|
||||
contact_links:
|
||||
- name: Godot community channels
|
||||
url: https://godotengine.org/community
|
||||
about: Please ask for technical support on one of the other community channels, not here.
|
||||
71
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
71
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
name: Feature request
|
||||
description: Request a new feature to be added or improved in Godot Tools VS Code add-on
|
||||
labels:
|
||||
- enhancement
|
||||
body:
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
- Write a descriptive issue title above.
|
||||
- Search [open](https://github.com/godotengine/godot-vscode-plugin/issues) and [closed](https://github.com/godotengine/godot-vscode-plugin/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported.
|
||||
- Verify that you are using a [supported Godot version](https://docs.godotengine.org/en/stable/about/release_policy.html).
|
||||
- This repository only contains the LSP *client*. Issues pertaining to the Godot editor itself or the LSP's *server* side should be reported on the [main Godot repository](https://github.com/godotengine/godot/issues).
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Godot version
|
||||
description: >
|
||||
Specify the Git commit hash if using a development or non-official build.
|
||||
If you use a custom build, please test if your issue is reproducible in official builds too.
|
||||
placeholder: 3.3.stable, 4.0.dev (3041becc6)
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: VS Code version
|
||||
description: >
|
||||
Use the **Help > About** menu to see your current version.
|
||||
Specify the Git commit hash if using a development or non-official build.
|
||||
If you use a custom build, please test if your issue is reproducible in official builds too.
|
||||
placeholder: "1.64.2"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Godot Tools VS Code extension version
|
||||
description: >
|
||||
Open the **Extensions** side panel and click on the **godot-tools** extension to see your current version.
|
||||
Specify the Git commit hash if using a development or non-official build.
|
||||
If you use a custom build, please test if your issue is reproducible in official builds too.
|
||||
placeholder: "1.3.1"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: System information
|
||||
description: |
|
||||
Specify the OS version, and when relevant hardware information.
|
||||
placeholder: Windows 10
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Problem statement
|
||||
description: |
|
||||
Describe the problem or limitation you're currently facing with the Godot Tools extension.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Proposed solution
|
||||
description: |
|
||||
Describe your proposed solution and how it resolves the problem or limitation mentioned above.
|
||||
You can include images or videos with drag and drop, and format code blocks or logs with <code>```</code> tags.
|
||||
validations:
|
||||
required: true
|
||||
11
.github/workflows/ci.yml
vendored
11
.github/workflows/ci.yml
vendored
@@ -6,21 +6,22 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v2.1.2
|
||||
uses: actions/setup-node@v3.3.0
|
||||
with:
|
||||
node-version: 12.x
|
||||
node-version: 16.x
|
||||
|
||||
- name: Lint and build extension
|
||||
run: |
|
||||
npm install
|
||||
npm run lint
|
||||
node_modules/.bin/vsce package --out godot-tools.vsix
|
||||
npm run package -- --out godot-tools.vsix
|
||||
ls -l godot-tools.vsix
|
||||
|
||||
- name: Upload extension VSIX
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3.1.0
|
||||
with:
|
||||
name: godot-tools
|
||||
path: godot-tools.vsix
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,3 +7,4 @@ test
|
||||
configurations/tmp.txt
|
||||
configurations/test.py
|
||||
.vscode-test
|
||||
workspace.code-workspace
|
||||
|
||||
30
CHANGELOG.md
30
CHANGELOG.md
@@ -1,5 +1,35 @@
|
||||
# Change Log
|
||||
|
||||
### 1.3.1
|
||||
* [Fix regression in launching debugger](https://github.com/godotengine/godot-vscode-plugin/pull/371)
|
||||
* [Fix operator syntax highlighting when next to an opening parenthesis](https://github.com/godotengine/godot-vscode-plugin/pull/375)
|
||||
|
||||
### 1.3.0
|
||||
* [Add context menu options to copy resource path](https://github.com/godotengine/godot-vscode-plugin/pull/357)
|
||||
* [Add option to run the project with visible collision shapes and navigation](https://github.com/godotengine/godot-vscode-plugin/pull/312)
|
||||
* [Overhaul syntax highlighting](https://github.com/godotengine/godot-vscode-plugin/pull/342)
|
||||
* [Mention that the Godot editor must be running in connection error message](https://github.com/godotengine/godot-vscode-plugin/pull/358)
|
||||
* [Fix automatic indentation on line breaks not working as expected](https://github.com/godotengine/godot-vscode-plugin/pull/344)
|
||||
|
||||
### 1.2.0
|
||||
* [Add support for setting language-server-host](https://github.com/godotengine/godot-vscode-plugin/pull/297)
|
||||
* [Improve syntax highlighting](https://github.com/godotengine/godot-vscode-plugin/pull/330)
|
||||
* [Update LSP client to 7.0.0 to use the 3.16.0 specification](https://github.com/godotengine/godot-vscode-plugin/pull/264)
|
||||
* [Fix some `$` node path shorthand regex bugs in syntax highlighting](https://github.com/godotengine/godot-vscode-plugin/pull/340)
|
||||
* [Fix handling of Windows terminals determined by profiles](https://github.com/godotengine/godot-vscode-plugin/pull/303)
|
||||
* [Fix "static func" indent error](https://github.com/godotengine/godot-vscode-plugin/pull/279)
|
||||
* [Fix restart of debugging sessions](https://github.com/godotengine/godot-vscode-plugin/pull/327)
|
||||
* [Use the LSP defined SymbolKind enum and fix marked](https://github.com/godotengine/godot-vscode-plugin/pull/325)
|
||||
* [Fix "Continue" for multiple breakpoints in the same script](https://github.com/godotengine/godot-vscode-plugin/pull/324)
|
||||
|
||||
### 1.1.3
|
||||
* [Fix conditional breakpoints being parsed as regular breakpoints](https://github.com/godotengine/godot-vscode-plugin/pull/278)
|
||||
- [Add `in` to the list of keywords and add rule for `$` shorthand](https://github.com/godotengine/godot-vscode-plugin/pull/274)
|
||||
- [Fix typo in snippets: "decleration" -> "declaration"](https://github.com/godotengine/godot-vscode-plugin/pull/262)
|
||||
- [Add `remote` keyword to syntax highlighting](https://github.com/godotengine/godot-vscode-plugin/pull/257)
|
||||
- [Remove the configuration item `godot-tools.check_config` as it has no effect](https://github.com/godotengine/godot-vscode-plugin/pull/246)
|
||||
- [Fix the syntax of escaped characters in strings](https://github.com/godotengine/godot-vscode-plugin/pull/247)
|
||||
|
||||
### 1.1.1
|
||||
* Fix bug for GDScript debugger
|
||||
* Add TCP protocol support for GDScript language server Godot 3.2.2
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016-2019 The Godot Engine community
|
||||
Copyright (c) 2016-2022 The Godot Engine community
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
21
README.md
21
README.md
@@ -3,7 +3,7 @@
|
||||
A complete set of tools to code games with
|
||||
[Godot Engine](http://www.godotengine.org/) in Visual Studio Code.
|
||||
|
||||
**IMPORTANT NOTE:** Versions 1.0.0 and later of this plugin only support
|
||||
**IMPORTANT NOTE:** Versions 1.0.0 and later of this extension only support
|
||||
Godot 3.2 or later.
|
||||
|
||||
## Features
|
||||
@@ -25,6 +25,20 @@ experience as comfortable as possible:
|
||||
|
||||

|
||||
|
||||
## Download
|
||||
|
||||
- [Visual Studio Marketplace **(recommended)**](https://marketplace.visualstudio.com/items?itemName=geequlim.godot-tools)
|
||||
- Stable release, with support for automatic updates.
|
||||
- [GitHub Releases](https://github.com/godotengine/godot-vscode-plugin/releases)
|
||||
- Stable release, but no automatic updates. Can be useful if you need to install an older version of the extension.
|
||||
- [Development build (follows the `master` branch)](https://nightly.link/godotengine/godot-vscode-plugin/workflows/ci/master/godot-tools.zip)
|
||||
- Development build. Contains new features and fixes not available in stable releases, but may be unstable.
|
||||
- Extract the ZIP archive before installing (it contains the `.vsix` file inside).
|
||||
|
||||
To install from GitHub Releases or a development build,
|
||||
see [Install from a VSIX](https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix)
|
||||
in the Visual Studio Code documentation.
|
||||
|
||||
## Available commands
|
||||
|
||||
The extension adds a few entries to the VS Code Command Palette under "Godot Tools":
|
||||
@@ -44,6 +58,7 @@ for Godot by following these steps:
|
||||
2. Select **Text Editor > External**
|
||||
3. Make sure the **Use External Editor** box is checked
|
||||
4. Fill **Exec Path** with the path to your VS Code executable
|
||||
* On macOS, this executable is typically located at: `/Applications/Visual Studio Code.app/Contents/MacOS/Electron`
|
||||
5. Fill **Exec Flags** with `{project} --goto {file}:{line}:{col}`
|
||||
|
||||
### VS Code
|
||||
@@ -103,14 +118,12 @@ for the latest changes.
|
||||
#### Requirements
|
||||
|
||||
- [npm](https://www.npmjs.com/get-npm)
|
||||
- Typescript to compile, installed using npm with `npm install -g typescript`
|
||||
- VSCE to create a VSIX file, installed using npm with `npm install -g vsce`
|
||||
|
||||
#### Process
|
||||
|
||||
1. Open a command prompt/terminal and browse to the location of this repository on your local filesystem.
|
||||
2. Download dependencies by using the command `npm install`
|
||||
3. When done, package a VSIX file by using the command `vsce package`.
|
||||
3. When done, package a VSIX file by using the command `npm run package`.
|
||||
4. Install it by opening Visual Studio Code, opening the Extensions tab, clicking on the More actions (**...**) button in the top right, and choose **Install from VSIX...** and find the compiled VSIX file.
|
||||
|
||||
When developing for the extension, you can open this project in Visual Studio Code and debug the extension by using the **Run Extension** launch configuration instead of going through steps 3 and 4. It will launch a new instance of Visual Studio Code that has the extension running. You can then open a Godot project folder and debug the extension or GDScript debugger.
|
||||
|
||||
24
configurations/gdresource-configuration.json
Normal file
24
configurations/gdresource-configuration.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"comments": {
|
||||
"lineComment": ";"
|
||||
},
|
||||
"brackets": [
|
||||
["(", ")"],
|
||||
["[", "]"],
|
||||
["{", "}"]
|
||||
],
|
||||
"autoClosingPairs": [
|
||||
["'", "'"],
|
||||
["\"", "\""],
|
||||
["(", ")"],
|
||||
["[", "]"],
|
||||
["{", "}"]
|
||||
],
|
||||
"surroundingPairs": [
|
||||
["'", "'"],
|
||||
["\"", "\""],
|
||||
["(", ")"],
|
||||
["[", "]"],
|
||||
["{", "}"]
|
||||
]
|
||||
}
|
||||
@@ -1,36 +1,86 @@
|
||||
{
|
||||
"comments": {
|
||||
"lineComment": "#",
|
||||
"blockComment": ["\"\"\"", "\"\"\""]
|
||||
"blockComment": [
|
||||
"\"\"\"",
|
||||
"\"\"\""
|
||||
]
|
||||
},
|
||||
"brackets": [
|
||||
["(", ")"],
|
||||
["[", "]"],
|
||||
["{", "}"]
|
||||
[
|
||||
"(",
|
||||
")"
|
||||
],
|
||||
[
|
||||
"[",
|
||||
"]"
|
||||
],
|
||||
[
|
||||
"{",
|
||||
"}"
|
||||
]
|
||||
],
|
||||
"autoClosingPairs": [
|
||||
["'", "'"],
|
||||
["\"", "\""],
|
||||
["(", ")"],
|
||||
["[", "]"],
|
||||
["{", "}"]
|
||||
[
|
||||
"'",
|
||||
"'"
|
||||
],
|
||||
[
|
||||
"\"",
|
||||
"\""
|
||||
],
|
||||
[
|
||||
"(",
|
||||
")"
|
||||
],
|
||||
[
|
||||
"[",
|
||||
"]"
|
||||
],
|
||||
[
|
||||
"{",
|
||||
"}"
|
||||
]
|
||||
],
|
||||
"surroundingPairs": [
|
||||
["'", "'"],
|
||||
["\"", "\""],
|
||||
["(", ")"],
|
||||
["[", "]"],
|
||||
["{", "}"]
|
||||
[
|
||||
"'",
|
||||
"'"
|
||||
],
|
||||
[
|
||||
"\"",
|
||||
"\""
|
||||
],
|
||||
[
|
||||
"(",
|
||||
")"
|
||||
],
|
||||
[
|
||||
"[",
|
||||
"]"
|
||||
],
|
||||
[
|
||||
"{",
|
||||
"}"
|
||||
]
|
||||
],
|
||||
"indentationRules": {
|
||||
"increaseIndentPattern": "^\\s*((class|func|else|elif|for|if|match|while|enum)|(.*\\sdo\\b))\\b[^\\{;]*$",
|
||||
"increaseIndentPattern": "^\\s*((class|static func|func|else|elif|for|if|match|while|enum)|(.*\\sdo\\b))\\b[^\\{;]*$",
|
||||
"decreaseIndentPattern": "^\\s*([}\\]]([,)]?\\s*(#|$)|\\.[a-zA-Z_]\\w*\\b)|(else|elif)\\b)"
|
||||
},
|
||||
"folding": {
|
||||
"offSide": true,
|
||||
"markers": {
|
||||
"start": "^\\s*#\\s*region\\b",
|
||||
"end": "^\\s*#\\s*endregion\\b"
|
||||
}
|
||||
}
|
||||
"offSide": true,
|
||||
"markers": {
|
||||
"start": "^\\s*#\\s*region\\b",
|
||||
"end": "^\\s*#\\s*endregion\\b"
|
||||
}
|
||||
},
|
||||
"onEnterRules": [
|
||||
{
|
||||
"beforeText": "^\\s*$",
|
||||
"action": {
|
||||
"indent": "none"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
25
configurations/gdshader-configuration.json
Normal file
25
configurations/gdshader-configuration.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"comments": {
|
||||
"lineComment": "//",
|
||||
"blockComment": ["/*", "*/"]
|
||||
},
|
||||
"brackets": [
|
||||
["(", ")"],
|
||||
["[", "]"],
|
||||
["{", "}"]
|
||||
],
|
||||
"autoClosingPairs": [
|
||||
["'", "'"],
|
||||
["\"", "\""],
|
||||
["(", ")"],
|
||||
["[", "]"],
|
||||
["{", "}"]
|
||||
],
|
||||
"surroundingPairs": [
|
||||
["'", "'"],
|
||||
["\"", "\""],
|
||||
["(", ")"],
|
||||
["[", "]"],
|
||||
["{", "}"]
|
||||
]
|
||||
}
|
||||
@@ -132,7 +132,7 @@
|
||||
]
|
||||
},
|
||||
|
||||
"signal decleration": {
|
||||
"signal declaration": {
|
||||
"prefix": "signal",
|
||||
"body": [
|
||||
"signal ${1:signalname}(${2:args})"
|
||||
|
||||
BIN
icon.png
BIN
icon.png
Binary file not shown.
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.4 KiB |
2818
package-lock.json
generated
2818
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
127
package.json
127
package.json
@@ -2,24 +2,33 @@
|
||||
"name": "godot-tools",
|
||||
"displayName": "godot-tools",
|
||||
"icon": "icon.png",
|
||||
"version": "1.1.2",
|
||||
"description": "Tools for game development with godot game engine",
|
||||
"version": "1.3.1",
|
||||
"description": "Tools for game development with Godot Engine and GDScript",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/godotengine/godot-vscode-plugin"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/godotengine/godot-vscode-plugin/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": "The Godot Engine community",
|
||||
"publisher": "geequlim",
|
||||
"engines": {
|
||||
"vscode": "^1.33.0"
|
||||
},
|
||||
"categories": [
|
||||
"Other",
|
||||
"Debuggers"
|
||||
"Programming Languages",
|
||||
"Linters",
|
||||
"Snippets",
|
||||
"Debuggers",
|
||||
"Other"
|
||||
],
|
||||
"activationEvents": [
|
||||
"workspaceContains:project.godot",
|
||||
"onLanguage:gdscript",
|
||||
"onLanguage:gdshader",
|
||||
"onLanguage:gdresource",
|
||||
"onDebugResolve:godot"
|
||||
],
|
||||
"main": "./out/extension.js",
|
||||
@@ -27,7 +36,8 @@
|
||||
"vscode:prepublish": "npm run compile",
|
||||
"compile": "tsc -p ./",
|
||||
"lint": "tslint -p ./",
|
||||
"watch": "tsc -watch -p ./"
|
||||
"watch": "tsc -watch -p ./",
|
||||
"package": "vsce package"
|
||||
},
|
||||
"contributes": {
|
||||
"commands": [
|
||||
@@ -39,6 +49,10 @@
|
||||
"command": "godot-tool.run_project",
|
||||
"title": "Godot Tools: Run workspace as Godot project"
|
||||
},
|
||||
{
|
||||
"command": "godot-tool.run_project_debug",
|
||||
"title": "Godot Tools: Run workspace as Godot project with visible collision shapes and navigation meshes"
|
||||
},
|
||||
{
|
||||
"command": "godot-tool.list_native_classes",
|
||||
"title": "Godot Tools: List native classes of godot"
|
||||
@@ -78,6 +92,14 @@
|
||||
{
|
||||
"command": "godot-tool.set_scene_file",
|
||||
"title": "Set as Scene File"
|
||||
},
|
||||
{
|
||||
"command": "godot-tool.copy_resource_path_context",
|
||||
"title": "Copy Resource Path"
|
||||
},
|
||||
{
|
||||
"command": "godot-tool.copy_resource_path",
|
||||
"title": "Godot Tools: Copy Resource Path"
|
||||
}
|
||||
],
|
||||
"configuration": {
|
||||
@@ -99,6 +121,11 @@
|
||||
],
|
||||
"description": "The server protocol of the GDScript language server.\nYou have restart VSCode editor after change this value."
|
||||
},
|
||||
"godot_tools.gdscript_lsp_server_host": {
|
||||
"type": "string",
|
||||
"default": "127.0.0.1",
|
||||
"description": "The server host of the GDScript language server"
|
||||
},
|
||||
"godot_tools.gdscript_lsp_server_port": {
|
||||
"type": "number",
|
||||
"default": 6008,
|
||||
@@ -113,6 +140,31 @@
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"description": "The scene file to run"
|
||||
},
|
||||
"godot_tools.reconnect_automatically": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "Whether the plugin should attempt to reconnect"
|
||||
},
|
||||
"godot_tools.reconnect_cooldown": {
|
||||
"type": "number",
|
||||
"default": 3000,
|
||||
"description": "The number of milliseconds to wait before attempting to reconnect"
|
||||
},
|
||||
"godot_tools.reconnect_attempts": {
|
||||
"type": "number",
|
||||
"default": 10,
|
||||
"description": "How many times the client will attempt to reconnect"
|
||||
},
|
||||
"godot_tools.force_visible_collision_shapes": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Force the project to run with visible collision shapes"
|
||||
},
|
||||
"godot_tools.force_visible_nav_mesh": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Force the project to run with visible navigation meshes"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -129,16 +181,30 @@
|
||||
"configuration": "./configurations/gdscript-configuration.json"
|
||||
},
|
||||
{
|
||||
"id": "properties",
|
||||
"id": "gdresource",
|
||||
"aliases": [
|
||||
"GDResource",
|
||||
"gdresource"
|
||||
],
|
||||
"extensions": [
|
||||
"cfg",
|
||||
"godot",
|
||||
"tres",
|
||||
"tscn",
|
||||
"godot",
|
||||
"import",
|
||||
"gdns",
|
||||
"gdnlib",
|
||||
"import"
|
||||
]
|
||||
"gdnlib"
|
||||
],
|
||||
"configuration": "./configurations/gdresource-configuration.json"
|
||||
},
|
||||
{
|
||||
"id": "gdshader",
|
||||
"aliases": [
|
||||
"gdshader"
|
||||
],
|
||||
"extensions": [
|
||||
".gdshader"
|
||||
],
|
||||
"configuration": "./configurations/gdshader-configuration.json"
|
||||
}
|
||||
],
|
||||
"grammars": [
|
||||
@@ -146,6 +212,16 @@
|
||||
"language": "gdscript",
|
||||
"scopeName": "source.gdscript",
|
||||
"path": "./syntaxes/GDScript.tmLanguage.json"
|
||||
},
|
||||
{
|
||||
"language": "gdresource",
|
||||
"scopeName": "source.gdresource",
|
||||
"path": "./syntaxes/GDResource.tmLanguage.json"
|
||||
},
|
||||
{
|
||||
"language": "gdshader",
|
||||
"scopeName": "source.gdshader",
|
||||
"path": "./syntaxes/GDShader.tmLanguage.json"
|
||||
}
|
||||
],
|
||||
"snippets": [
|
||||
@@ -283,29 +359,40 @@
|
||||
{
|
||||
"command": "godot-tool.set_scene_file",
|
||||
"group": "2_workspace"
|
||||
},
|
||||
{
|
||||
"command": "godot-tool.copy_resource_path_context",
|
||||
"group": "6_copypath"
|
||||
}
|
||||
],
|
||||
"editor/title/context": [
|
||||
{
|
||||
"command": "godot-tool.copy_resource_path_context",
|
||||
"group": "1_godot"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/marked": "^0.6.5",
|
||||
"@types/mocha": "^2.2.42",
|
||||
"@types/mocha": "^9.1.0",
|
||||
"@types/node": "^10.12.21",
|
||||
"@types/prismjs": "^1.16.0",
|
||||
"@types/prismjs": "^1.16.8",
|
||||
"@types/vscode": "^1.33.0",
|
||||
"@types/ws": "^6.0.1",
|
||||
"tslint": "^5.16.0",
|
||||
"@types/ws": "^8.2.2",
|
||||
"tslint": "^5.20.1",
|
||||
"typescript": "^3.5.1",
|
||||
"vsce": "^1.76.1"
|
||||
"vsce": "^2.6.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"await-notify": "^1.0.1",
|
||||
"global": "^4.4.0",
|
||||
"marked": "^0.7.0",
|
||||
"klaw": "^4.0.1",
|
||||
"marked": "^4.0.11",
|
||||
"net": "^1.0.2",
|
||||
"terminate": "^2.1.2",
|
||||
"terminate": "^2.5.0",
|
||||
"vscode-debugadapter": "^1.38.0",
|
||||
"vscode-languageclient": "^5.2.1",
|
||||
"ws": "^7.0.0"
|
||||
"vscode-languageclient": "^7.0.0",
|
||||
"ws": "^8.4.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,8 +82,9 @@ export class GodotDebugData {
|
||||
|
||||
bps.push(bp);
|
||||
|
||||
let out_file = `res://${path.relative(this.project_path, bp.file)}`;
|
||||
|
||||
Mediator.notify("set_breakpoint", [out_file.replace(/\\/g, "/"), line]);
|
||||
if (this.project_path) {
|
||||
let out_file = `res://${path.relative(this.project_path, bp.file)}`;
|
||||
Mediator.notify("set_breakpoint", [out_file.replace(/\\/g, "/"), line]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ export class GodotDebugSession extends LoggingDebugSession {
|
||||
args: DebugProtocol.ConfigurationDoneArguments
|
||||
) {
|
||||
this.configuration_done.notify();
|
||||
this.sendResponse(response);
|
||||
}
|
||||
|
||||
public set_scopes(
|
||||
@@ -236,7 +237,7 @@ export class GodotDebugSession extends LoggingDebugSession {
|
||||
args.launch_scene,
|
||||
get_configuration("scene_file_config", "") || args.scene_file,
|
||||
]);
|
||||
|
||||
|
||||
this.sendResponse(response);
|
||||
}
|
||||
|
||||
@@ -298,7 +299,10 @@ export class GodotDebugSession extends LoggingDebugSession {
|
||||
});
|
||||
client_lines.forEach((l) => {
|
||||
if (bp_lines.indexOf(l) === -1) {
|
||||
this.debug_data.set_breakpoint(path, l);
|
||||
let bp = args.breakpoints.find((bp_at_line) => (bp_at_line.line == l));
|
||||
if (!bp.condition) {
|
||||
this.debug_data.set_breakpoint(path, l);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -98,7 +98,17 @@ export class ServerController {
|
||||
|
||||
if (launch_instance) {
|
||||
let godot_path: string = utils.get_configuration("editor_path", "godot");
|
||||
const force_visible_collision_shapes = utils.get_configuration("force_visible_collision_shapes", false);
|
||||
const force_visible_nav_mesh = utils.get_configuration("force_visible_nav_mesh", false);
|
||||
|
||||
let executable_line = `"${godot_path}" --path "${project_path}" --remote-debug ${address}:${port}`;
|
||||
|
||||
if (force_visible_collision_shapes) {
|
||||
executable_line += " --debug-collisions";
|
||||
}
|
||||
if (force_visible_nav_mesh) {
|
||||
executable_line += " --debug-navigation";
|
||||
}
|
||||
if (launch_scene) {
|
||||
let filename = "";
|
||||
if (scene_file) {
|
||||
@@ -266,9 +276,8 @@ export class ServerController {
|
||||
if (breakpoints.length > 0) {
|
||||
output += " --breakpoints ";
|
||||
breakpoints.forEach((bp, i) => {
|
||||
output += `${this.breakpoint_path(project_path, bp.file)}:${bp.line}${
|
||||
i < breakpoints.length - 1 ? "," : ""
|
||||
}`;
|
||||
output += `${this.breakpoint_path(project_path, bp.file)}:${bp.line}${i < breakpoints.length - 1 ? "," : ""
|
||||
}`;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ export function activate(context: ExtensionContext) {
|
||||
}
|
||||
|
||||
export function deactivate(): Thenable<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
tools.deactivate();
|
||||
resolve();
|
||||
});
|
||||
|
||||
@@ -8,11 +8,15 @@ const CONFIG_CONTAINER = "godot_tools";
|
||||
const TOOL_NAME = "GodotTools";
|
||||
|
||||
export class GodotTools {
|
||||
|
||||
private reconnection_attempts = 0;
|
||||
private context: vscode.ExtensionContext;
|
||||
private client: GDScriptLanguageClient = null;
|
||||
// deprecated, need to replace with "vscode.workspace.workspaceFolders", but
|
||||
// that's an array and not a single value
|
||||
private workspace_dir = vscode.workspace.rootPath;
|
||||
private project_file = "project.godot";
|
||||
private project_file_name = "project.godot";
|
||||
private project_file = "";
|
||||
private project_dir = ""
|
||||
private connection_status: vscode.StatusBarItem = null;
|
||||
|
||||
constructor(p_context: vscode.ExtensionContext) {
|
||||
@@ -20,41 +24,59 @@ export class GodotTools {
|
||||
this.client = new GDScriptLanguageClient(p_context);
|
||||
this.client.watch_status(this.on_client_status_changed.bind(this));
|
||||
this.connection_status = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
|
||||
|
||||
setInterval(() => {
|
||||
this.retry_callback();
|
||||
}, get_configuration("reconnect_cooldown", 3000));
|
||||
}
|
||||
|
||||
public activate() {
|
||||
vscode.commands.registerCommand("godot-tool.open_editor", ()=>{
|
||||
this.open_workspace_with_editor("-e").catch(err=>vscode.window.showErrorMessage(err));
|
||||
vscode.commands.registerCommand("godot-tool.open_editor", () => {
|
||||
this.open_workspace_with_editor("-e").catch(err => vscode.window.showErrorMessage(err));
|
||||
});
|
||||
vscode.commands.registerCommand("godot-tool.run_project", ()=>{
|
||||
this.open_workspace_with_editor().catch(err=>vscode.window.showErrorMessage(err));
|
||||
vscode.commands.registerCommand("godot-tool.run_project", () => {
|
||||
this.open_workspace_with_editor().catch(err => vscode.window.showErrorMessage(err));
|
||||
});
|
||||
vscode.commands.registerCommand("godot-tool.run_project_debug", () => {
|
||||
this.open_workspace_with_editor("--debug-collisions --debug-navigation").catch(err => vscode.window.showErrorMessage(err));
|
||||
});
|
||||
vscode.commands.registerCommand("godot-tool.check_status", this.check_client_status.bind(this));
|
||||
vscode.commands.registerCommand("godot-tool.set_scene_file", this.set_scene_file.bind(this));
|
||||
vscode.commands.registerCommand("godot-tool.copy_resource_path_context", this.copy_resource_path.bind(this));
|
||||
vscode.commands.registerCommand("godot-tool.copy_resource_path", this.copy_resource_path.bind(this));
|
||||
|
||||
this.connection_status.text = "$(sync) Initializing";
|
||||
this.connection_status.command = "godot-tool.check_status";
|
||||
this.connection_status.show();
|
||||
|
||||
// TODO: maybe cache this result somehow
|
||||
const klaw = require('klaw');
|
||||
klaw(this.workspace_dir)
|
||||
.on('data', item => {
|
||||
if (path.basename(item.path) == this.project_file_name) {
|
||||
this.project_dir = path.dirname(item.path);
|
||||
this.project_file = item.path;
|
||||
}
|
||||
});
|
||||
|
||||
this.reconnection_attempts = 0;
|
||||
this.client.connect_to_server();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public deactivate() {
|
||||
this.client.stop();
|
||||
}
|
||||
|
||||
|
||||
private open_workspace_with_editor(params = "") {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let valid = false;
|
||||
if (this.workspace_dir) {
|
||||
let cfg = path.join(this.workspace_dir, this.project_file);
|
||||
if (this.project_dir) {
|
||||
let cfg = this.project_file;
|
||||
valid = (fs.existsSync(cfg) && fs.statSync(cfg).isFile());
|
||||
}
|
||||
if (valid) {
|
||||
this.run_editor(`--path "${this.workspace_dir}" ${params}`).then(()=>resolve()).catch(err=>{
|
||||
this.run_editor(`--path "${this.project_dir}" ${params}`).then(() => resolve()).catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
} else {
|
||||
@@ -63,6 +85,22 @@ export class GodotTools {
|
||||
});
|
||||
}
|
||||
|
||||
private copy_resource_path(uri: vscode.Uri) {
|
||||
if (!this.project_dir) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!uri) {
|
||||
uri = vscode.window.activeTextEditor.document.uri
|
||||
}
|
||||
|
||||
let relative_path = path.normalize(path.relative(this.project_dir, uri.fsPath));
|
||||
relative_path = relative_path.split(path.sep).join(path.posix.sep);
|
||||
relative_path = 'res://' + relative_path;
|
||||
|
||||
vscode.env.clipboard.writeText(relative_path);
|
||||
}
|
||||
|
||||
private set_scene_file(uri: vscode.Uri) {
|
||||
let right_clicked_scene_path = uri.fsPath
|
||||
let scene_config = get_configuration("scene_file_config");
|
||||
@@ -72,25 +110,57 @@ export class GodotTools {
|
||||
else {
|
||||
scene_config = right_clicked_scene_path
|
||||
}
|
||||
|
||||
|
||||
set_configuration("scene_file_config", scene_config);
|
||||
}
|
||||
|
||||
|
||||
private run_editor(params = "") {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const run_godot = (path: string, params: string) => {
|
||||
const is_powershell_path = (path?: string) => {
|
||||
const POWERSHELL = "powershell.exe";
|
||||
const POWERSHELL_CORE = "pwsh.exe";
|
||||
return path && (path.endsWith(POWERSHELL) || path.endsWith(POWERSHELL_CORE));
|
||||
};
|
||||
const escape_command = (cmd: string) => {
|
||||
let cmdEsc = `"${cmd}"`;
|
||||
const cmdEsc = `"${cmd}"`;
|
||||
if (process.platform === "win32") {
|
||||
const POWERSHELL = "powershell.exe";
|
||||
const POWERSHELL_CORE = "pwsh.exe";
|
||||
const shell_plugin = vscode.workspace.getConfiguration("terminal.integrated.shell");
|
||||
let shell = (shell_plugin ? shell_plugin.get("windows", POWERSHELL) : POWERSHELL) || POWERSHELL;
|
||||
if (shell.endsWith(POWERSHELL) || shell.endsWith(POWERSHELL_CORE)) {
|
||||
cmdEsc = `&${cmdEsc}`;
|
||||
|
||||
if (shell_plugin) {
|
||||
const shell = shell_plugin.get<string>("windows");
|
||||
if (shell) {
|
||||
if (is_powershell_path(shell)) {
|
||||
return `&${cmdEsc}`;
|
||||
} else {
|
||||
return cmdEsc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const POWERSHELL_SOURCE = "PowerShell"
|
||||
const default_profile = vscode.workspace.getConfiguration("terminal.integrated.defaultProfile");
|
||||
if (default_profile) {
|
||||
const profile_name = default_profile.get<string>("windows");
|
||||
if (profile_name) {
|
||||
if (POWERSHELL_SOURCE === profile_name) {
|
||||
return `&${cmdEsc}`;
|
||||
}
|
||||
const profiles = vscode.workspace.getConfiguration("terminal.integrated.profiles.windows");
|
||||
const profile = profiles.get<{ source?: string, path?: string }>(profile_name);
|
||||
if (profile) {
|
||||
if (POWERSHELL_SOURCE === profile.source || is_powershell_path(profile.path)) {
|
||||
return `&${cmdEsc}`;
|
||||
} else {
|
||||
return cmdEsc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// default for Windows if nothing is set is PowerShell
|
||||
return `&${cmdEsc}`
|
||||
|
||||
}
|
||||
return cmdEsc;
|
||||
};
|
||||
@@ -110,19 +180,19 @@ export class GodotTools {
|
||||
editorPath = editorPath.replace("${workspaceRoot}", this.workspace_dir);
|
||||
if (!fs.existsSync(editorPath) || !fs.statSync(editorPath).isFile()) {
|
||||
vscode.window.showOpenDialog({
|
||||
openLabel: "Run",
|
||||
filters: process.platform === "win32" ? {"Godot Editor Binary": ["exe", "EXE"]} : undefined
|
||||
}).then((uris: vscode.Uri[])=> {
|
||||
if (!uris) {
|
||||
return;
|
||||
}
|
||||
let path = uris[0].fsPath;
|
||||
if (!fs.existsSync(path) || !fs.statSync(path).isFile()) {
|
||||
reject("Invalid editor path to run the project");
|
||||
} else {
|
||||
run_godot(path, params);
|
||||
set_configuration("editor_path", path);
|
||||
}
|
||||
openLabel: "Run",
|
||||
filters: process.platform === "win32" ? { "Godot Editor Binary": ["exe", "EXE"] } : undefined
|
||||
}).then((uris: vscode.Uri[]) => {
|
||||
if (!uris) {
|
||||
return;
|
||||
}
|
||||
let path = uris[0].fsPath;
|
||||
if (!fs.existsSync(path) || !fs.statSync(path).isFile()) {
|
||||
reject("Invalid editor path to run the project");
|
||||
} else {
|
||||
run_godot(path, params);
|
||||
set_configuration("editor_path", path);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
run_godot(editorPath, params);
|
||||
@@ -131,9 +201,11 @@ export class GodotTools {
|
||||
}
|
||||
|
||||
private check_client_status() {
|
||||
let host = get_configuration("gdscript_lsp_server_host", "localhost");
|
||||
let port = get_configuration("gdscript_lsp_server_port", 6008);
|
||||
switch (this.client.status) {
|
||||
case ClientStatus.PENDING:
|
||||
vscode.window.showInformationMessage("Connecting to the GDScript language server...");
|
||||
vscode.window.showInformationMessage(`Connecting to the GDScript language server at ${host}:${port}`);
|
||||
break;
|
||||
case ClientStatus.CONNECTED:
|
||||
vscode.window.showInformationMessage("Connected to the GDScript language server.");
|
||||
@@ -145,12 +217,15 @@ export class GodotTools {
|
||||
}
|
||||
|
||||
private on_client_status_changed(status: ClientStatus) {
|
||||
let host = get_configuration("gdscript_lsp_server_host", "localhost");
|
||||
let port = get_configuration("gdscript_lsp_server_port", 6008);
|
||||
switch (status) {
|
||||
case ClientStatus.PENDING:
|
||||
this.connection_status.text = `$(sync) Connecting`;
|
||||
this.connection_status.tooltip = `Connecting to the GDScript language server...`;
|
||||
this.connection_status.tooltip = `Connecting to the GDScript language server at ${host}:${port}`;
|
||||
break;
|
||||
case ClientStatus.CONNECTED:
|
||||
this.retry = false;
|
||||
this.connection_status.text = `$(check) Connected`;
|
||||
this.connection_status.tooltip = `Connected to the GDScript language server.`;
|
||||
if (!this.client.started) {
|
||||
@@ -158,24 +233,55 @@ export class GodotTools {
|
||||
}
|
||||
break;
|
||||
case ClientStatus.DISCONNECTED:
|
||||
this.connection_status.text = `$(x) Disconnected`;
|
||||
this.connection_status.tooltip = `Disconnected from the GDScript language server.`;
|
||||
// retry
|
||||
this.retry_connect_client();
|
||||
if (this.retry) {
|
||||
this.connection_status.text = `$(sync) Connecting ` + this.reconnection_attempts;
|
||||
this.connection_status.tooltip = `Connecting to the GDScript language server...`;
|
||||
} else {
|
||||
this.connection_status.text = `$(x) Disconnected`;
|
||||
this.connection_status.tooltip = `Disconnected from the GDScript language server.`;
|
||||
}
|
||||
this.retry = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private retry = false;
|
||||
|
||||
private retry_callback() {
|
||||
if (this.retry) {
|
||||
this.retry_connect_client();
|
||||
}
|
||||
}
|
||||
|
||||
private retry_connect_client() {
|
||||
vscode.window.showErrorMessage(`Couldn't connect to the GDScript language server.`, 'Open Godot Editor', 'Retry', 'Ignore').then(item=>{
|
||||
const auto_retry = get_configuration("reconnect_automatically", true);
|
||||
const max_attempts = get_configuration("reconnect_attempts", 10);
|
||||
if (auto_retry && this.reconnection_attempts <= max_attempts) {
|
||||
this.reconnection_attempts++;
|
||||
this.client.connect_to_server();
|
||||
this.connection_status.text = `Connecting ` + this.reconnection_attempts;
|
||||
this.retry = true;
|
||||
return;
|
||||
}
|
||||
|
||||
this.retry = false
|
||||
this.connection_status.text = `$(x) Disconnected`;
|
||||
this.connection_status.tooltip = `Disconnected from the GDScript language server.`;
|
||||
|
||||
let host = get_configuration("gdscript_lsp_server_host", "localhost");
|
||||
let port = get_configuration("gdscript_lsp_server_port", 6008);
|
||||
let message = `Couldn't connect to the GDScript language server at ${host}:${port}. Is the Godot editor running?`;
|
||||
vscode.window.showErrorMessage(message, 'Open Godot Editor', 'Retry', 'Ignore').then(item => {
|
||||
if (item == 'Retry') {
|
||||
this.reconnection_attempts = 0;
|
||||
this.client.connect_to_server();
|
||||
} else if (item == 'Open Godot Editor') {
|
||||
this.client.status = ClientStatus.PENDING;
|
||||
this.open_workspace_with_editor("-e").then(()=>{
|
||||
setTimeout(()=>{
|
||||
this.open_workspace_with_editor("-e").then(() => {
|
||||
setTimeout(() => {
|
||||
this.reconnection_attempts = 0;
|
||||
this.client.connect_to_server();
|
||||
}, 10 * 1000);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { LanguageClient, LanguageClientOptions, ServerOptions, RequestMessage } from "vscode-languageclient";
|
||||
import { LanguageClient, LanguageClientOptions, ServerOptions, RequestMessage } from "vscode-languageclient/node";
|
||||
import { is_debug_mode, get_configuration } from "../utils";
|
||||
import { MessageIO, MessageIOReader, MessageIOWriter, Message, WebsocktMessageIO, TCPMessageIO } from "./MessageIO";
|
||||
import logger from "../loggger";
|
||||
@@ -74,8 +74,9 @@ export default class GDScriptLanguageClient extends LanguageClient {
|
||||
|
||||
connect_to_server() {
|
||||
this.status = ClientStatus.PENDING;
|
||||
let host = get_configuration("gdscript_lsp_server_host", "127.0.0.1");
|
||||
let port = get_configuration("gdscript_lsp_server_port", 6008);
|
||||
this.io.connect_to_language_server(port);
|
||||
this.io.connect_to_language_server(host, port);
|
||||
}
|
||||
|
||||
start(): vscode.Disposable {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { AbstractMessageReader, MessageReader, DataCallback } from "vscode-jsonrpc/lib/messageReader";
|
||||
import { AbstractMessageReader, MessageReader, DataCallback, Disposable } from "vscode-jsonrpc";
|
||||
import { EventEmitter } from "events";
|
||||
import * as WebSocket from 'ws';
|
||||
import { Socket } from 'net';
|
||||
|
||||
import MessageBuffer from "./MessageBuffer";
|
||||
import { AbstractMessageWriter, MessageWriter } from "vscode-jsonrpc/lib/messageWriter";
|
||||
import { RequestMessage, ResponseMessage, NotificationMessage } from "vscode-jsonrpc/lib/messages";
|
||||
import { AbstractMessageWriter, MessageWriter } from "vscode-jsonrpc";
|
||||
import { RequestMessage, ResponseMessage, NotificationMessage } from "vscode-jsonrpc";
|
||||
export type Message = RequestMessage | ResponseMessage | NotificationMessage;
|
||||
|
||||
export class MessageIO extends EventEmitter {
|
||||
@@ -30,7 +30,7 @@ export class MessageIO extends EventEmitter {
|
||||
this.emit("message", message);
|
||||
}
|
||||
|
||||
async connect_to_language_server(port: number): Promise<void> {
|
||||
async connect_to_language_server(host: string, port: number): Promise<void> {
|
||||
// virtual
|
||||
}
|
||||
}
|
||||
@@ -46,10 +46,10 @@ export class WebsocktMessageIO extends MessageIO {
|
||||
}
|
||||
}
|
||||
|
||||
async connect_to_language_server(port: number): Promise<void> {
|
||||
async connect_to_language_server(host:string, port: number): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.socket = null;
|
||||
const ws = new WebSocket(`ws://localhost:${port}`);
|
||||
const ws = new WebSocket(`ws://${host}:${port}`);
|
||||
ws.on('open', ()=>{ this.on_connected(ws); resolve(); });
|
||||
ws.on('message', this.on_message.bind(this));
|
||||
ws.on('error', this.on_disconnected.bind(this));
|
||||
@@ -77,11 +77,11 @@ export class TCPMessageIO extends MessageIO {
|
||||
}
|
||||
}
|
||||
|
||||
async connect_to_language_server(port: number):Promise<void> {
|
||||
async connect_to_language_server(host:string, port: number):Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.socket = null;
|
||||
const socket = new Socket();
|
||||
socket.connect(port);
|
||||
socket.connect(port, host);
|
||||
socket.on('connect', ()=>{ this.on_connected(socket); resolve(); });
|
||||
socket.on('data', this.on_message.bind(this));
|
||||
socket.on('end', this.on_disconnected.bind(this));
|
||||
@@ -127,7 +127,7 @@ export class MessageIOReader extends AbstractMessageReader implements MessageRea
|
||||
return this._partialMessageTimeout;
|
||||
}
|
||||
|
||||
public listen(callback: DataCallback): void {
|
||||
public listen(callback: DataCallback): Disposable {
|
||||
this.nextMessageLength = -1;
|
||||
this.messageToken = 0;
|
||||
this.partialMessageTimer = undefined;
|
||||
@@ -137,6 +137,8 @@ export class MessageIOReader extends AbstractMessageReader implements MessageRea
|
||||
});
|
||||
this.io.on('error', (error: any) => this.fireError(error));
|
||||
this.io.on('close', () => this.fireClose());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
private onData(data: Buffer | String): void {
|
||||
@@ -214,8 +216,12 @@ export class MessageIOWriter extends AbstractMessageWriter implements MessageWri
|
||||
this.io.on('error', (error: any) => this.fireError(error));
|
||||
this.io.on('close', () => this.fireClose());
|
||||
}
|
||||
|
||||
public end(): void {
|
||||
|
||||
}
|
||||
|
||||
public write(msg: Message): void {
|
||||
public write(msg: Message): Promise<void> {
|
||||
let json = JSON.stringify(msg);
|
||||
let contentLength = Buffer.byteLength(json, this.encoding);
|
||||
|
||||
@@ -235,5 +241,7 @@ export class MessageIOWriter extends AbstractMessageWriter implements MessageWri
|
||||
this.errorCount++;
|
||||
this.fireError(error, msg, this.errorCount);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as vscode from "vscode";
|
||||
import * as ls from "vscode-languageclient";
|
||||
import { EventEmitter } from "events";
|
||||
import { MessageIO } from "./MessageIO";
|
||||
import { NotificationMessage } from "vscode-jsonrpc";
|
||||
@@ -32,7 +33,7 @@ export default class NativeDocumentManager extends EventEmitter {
|
||||
this.io = io;
|
||||
io.on("message", (message: NotificationMessage) => {
|
||||
if (message.method == Methods.SHOW_NATIVE_SYMBOL) {
|
||||
this.show_native_symbol(message.params);
|
||||
this.show_native_symbol(message.params as GodotNativeSymbol);
|
||||
} else if (message.method == Methods.GDSCRIPT_CAPABILITIES) {
|
||||
for (const gdclass of (message.params as GodotCapabilities)
|
||||
.native_classes) {
|
||||
@@ -190,8 +191,8 @@ export default class NativeDocumentManager extends EventEmitter {
|
||||
with_class = false
|
||||
): { index?: string; body: string } {
|
||||
switch (s.kind) {
|
||||
case vscode.SymbolKind.Property:
|
||||
case vscode.SymbolKind.Variable:
|
||||
case ls.SymbolKind.Property:
|
||||
case ls.SymbolKind.Variable:
|
||||
{
|
||||
// var Control.anchor_left: float
|
||||
const parts = /\.([A-z_0-9]+)\:\s(.*)$/.exec(s.detail);
|
||||
@@ -215,7 +216,7 @@ export default class NativeDocumentManager extends EventEmitter {
|
||||
};
|
||||
}
|
||||
break;
|
||||
case vscode.SymbolKind.Constant:
|
||||
case ls.SymbolKind.Constant:
|
||||
{
|
||||
// const Control.FOCUS_ALL: FocusMode = 2
|
||||
// const Control.NOTIFICATION_RESIZED = 40
|
||||
@@ -243,7 +244,7 @@ export default class NativeDocumentManager extends EventEmitter {
|
||||
};
|
||||
}
|
||||
break;
|
||||
case vscode.SymbolKind.Event:
|
||||
case ls.SymbolKind.Event:
|
||||
{
|
||||
const parts = /\.([A-z0-9]+)\((.*)?\)/.exec(s.detail);
|
||||
if (!parts) {
|
||||
@@ -269,8 +270,8 @@ export default class NativeDocumentManager extends EventEmitter {
|
||||
};
|
||||
}
|
||||
break;
|
||||
case vscode.SymbolKind.Method:
|
||||
case vscode.SymbolKind.Function:
|
||||
case ls.SymbolKind.Method:
|
||||
case ls.SymbolKind.Function:
|
||||
{
|
||||
const signature = make_function_signature(s, with_class);
|
||||
const title = element("h4", signature);
|
||||
@@ -290,7 +291,7 @@ export default class NativeDocumentManager extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
if (symbol.kind == vscode.SymbolKind.Class) {
|
||||
if (symbol.kind == ls.SymbolKind.Class) {
|
||||
let doc = element("h2", `Native class ${symbol.name}`);
|
||||
const parts = /extends\s+([A-z0-9]+)/.exec(symbol.detail);
|
||||
let inherits = parts && parts.length > 1 ? parts[1] : "";
|
||||
@@ -326,19 +327,19 @@ export default class NativeDocumentManager extends EventEmitter {
|
||||
for (let s of symbol.children as GodotNativeSymbol[]) {
|
||||
const elements = make_symbol_elements(s);
|
||||
switch (s.kind) {
|
||||
case vscode.SymbolKind.Property:
|
||||
case vscode.SymbolKind.Variable:
|
||||
case ls.SymbolKind.Property:
|
||||
case ls.SymbolKind.Variable:
|
||||
properties_index += element("li", elements.index);
|
||||
propertyies += element("li", elements.body, { id: s.name });
|
||||
break;
|
||||
case vscode.SymbolKind.Constant:
|
||||
case ls.SymbolKind.Constant:
|
||||
constants += element("li", elements.body, { id: s.name });
|
||||
break;
|
||||
case vscode.SymbolKind.Event:
|
||||
case ls.SymbolKind.Event:
|
||||
signals += element("li", elements.body, { id: s.name });
|
||||
break;
|
||||
case vscode.SymbolKind.Method:
|
||||
case vscode.SymbolKind.Function:
|
||||
case ls.SymbolKind.Method:
|
||||
case ls.SymbolKind.Function:
|
||||
methods_index += element("li", elements.index);
|
||||
methods += element("li", elements.body, { id: s.name });
|
||||
break;
|
||||
@@ -373,11 +374,8 @@ export default class NativeDocumentManager extends EventEmitter {
|
||||
let doc = "";
|
||||
const elements = make_symbol_elements(symbol, true);
|
||||
if (elements.index) {
|
||||
if (
|
||||
[vscode.SymbolKind.Function, vscode.SymbolKind.Method].indexOf(
|
||||
symbol.kind
|
||||
) == -1
|
||||
) {
|
||||
const symbols: ls.SymbolKind[] = [ls.SymbolKind.Function, ls.SymbolKind.Method];
|
||||
if (!symbols.includes(symbol.kind)) {
|
||||
doc += element("h2", elements.index);
|
||||
}
|
||||
}
|
||||
@@ -419,7 +417,7 @@ function make_link(classname: string, symbol: string) {
|
||||
}
|
||||
|
||||
function make_codeblock(code: string) {
|
||||
const md = marked("```gdscript\n" + code + "\n```");
|
||||
const md = marked.parse("```gdscript\n" + code + "\n```");
|
||||
return `<div class="codeblock">${md}</div>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { DocumentSymbol } from "vscode";
|
||||
import { DocumentSymbol, Range, SymbolKind } from "vscode-languageclient";
|
||||
|
||||
|
||||
export const enum Methods {
|
||||
GDSCRIPT_CAPABILITIES = 'gdscript/capabilities',
|
||||
@@ -11,7 +12,15 @@ export interface NativeSymbolInspectParams {
|
||||
symbol_name: string;
|
||||
}
|
||||
|
||||
export class GodotNativeSymbol extends DocumentSymbol {
|
||||
export class GodotNativeSymbol implements DocumentSymbol {
|
||||
name: string;
|
||||
detail?: string;
|
||||
kind: SymbolKind;
|
||||
tags?: 1[];
|
||||
deprecated?: boolean;
|
||||
range: Range;
|
||||
selectionRange: Range;
|
||||
children?: DocumentSymbol[];
|
||||
documentation: string;
|
||||
native_class: string;
|
||||
}
|
||||
|
||||
4
syntaxes/.prettierrc.json
Normal file
4
syntaxes/.prettierrc.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"useTabs": false,
|
||||
"tabWidth": 4
|
||||
}
|
||||
329
syntaxes/GDResource.tmLanguage.json
Normal file
329
syntaxes/GDResource.tmLanguage.json
Normal file
@@ -0,0 +1,329 @@
|
||||
{
|
||||
"version": "v0.6.0",
|
||||
"scopeName": "source.gdresource",
|
||||
"uuid": "e076faa2-3c52-42fa-a8e6-9a7c453c1a5b",
|
||||
"information_for_contributors": [
|
||||
"aster: galaster@foxmail.com"
|
||||
],
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#embedded_shader"
|
||||
},
|
||||
{
|
||||
"include": "#embedded_gdscript"
|
||||
},
|
||||
{
|
||||
"include": "#comment"
|
||||
},
|
||||
{
|
||||
"include": "#heading"
|
||||
},
|
||||
{
|
||||
"include": "#key_value"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"comment": {
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.comment.gdresource"
|
||||
}
|
||||
},
|
||||
"match": "(;).*$\\n?",
|
||||
"name": "comment.line.gdresource"
|
||||
},
|
||||
"embedded_shader": {
|
||||
"name": "meta.embedded.block.gdshader",
|
||||
"begin": "(code) = \"",
|
||||
"end": "\"",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "variable.other.property.gdresource"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "source.gdshader"
|
||||
}
|
||||
]
|
||||
},
|
||||
"embedded_gdscript": {
|
||||
"comment": "meta.embedded.block.gdscript",
|
||||
"begin": "(script/source) = \"",
|
||||
"end": "\"",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "variable.other.property.gdresource"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "source.gdscript"
|
||||
}
|
||||
]
|
||||
},
|
||||
"heading": {
|
||||
"begin": "\\[([a-z_]*)\\s?",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.control.gdresource"
|
||||
}
|
||||
},
|
||||
"end": "\\]",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#heading_properties"
|
||||
},
|
||||
{
|
||||
"include": "#data"
|
||||
}
|
||||
]
|
||||
},
|
||||
"heading_properties": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "invalid.deprecated.noValue.gdresource",
|
||||
"match": "(\\s*[A-Za-z_\\-][A-Za-z0-9_\\-]*\\s*=)(?=\\s*$)"
|
||||
},
|
||||
{
|
||||
"begin": "\\s*([A-Za-z_-][^\\s]*|\".+\"|'.+'|[0-9]+)\\s*(=)\\s*",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "variable.other.property.gdresource"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.definition.keyValue.gdresource"
|
||||
}
|
||||
},
|
||||
"end": "($|(?==)|\\,?|\\s*(?=\\}))",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#data"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_value": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "invalid.deprecated.noValue.gdresource",
|
||||
"match": "(\\s*[A-Za-z_\\-][A-Za-z0-9_\\-]*\\s*=)(?=\\s*$)"
|
||||
},
|
||||
{
|
||||
"begin": "\\s*([A-Za-z_-][^\\s]*|\".+\"|'.+'|[0-9]+)\\s*(=)\\s*",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "variable.other.property.gdresource"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.definition.keyValue.gdresource"
|
||||
}
|
||||
},
|
||||
"end": "($|(?==)|\\,|\\s*(?=\\}))",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#data"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#comment"
|
||||
},
|
||||
{
|
||||
"begin": "(?<!\\w)(\\{)\\s*",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.table.inline.gdresource"
|
||||
}
|
||||
},
|
||||
"end": "\\s*(\\})(?!\\w)",
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.table.inline.gdresource"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#key_value"
|
||||
},
|
||||
{
|
||||
"include": "#data"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "(?<!\\w)(\\[)\\s*",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.array.gdresource"
|
||||
}
|
||||
},
|
||||
"end": "\\s*(\\])(?!\\w)",
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.array.gdresource"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#data"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "string.quoted.triple.basic.block.gdresource",
|
||||
"begin": "\"\"\"",
|
||||
"end": "\"\"\"",
|
||||
"patterns": [
|
||||
{
|
||||
"match": "\\\\([btnfr\"\\\\\\n/ ]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})",
|
||||
"name": "constant.character.escape.gdresource"
|
||||
},
|
||||
{
|
||||
"match": "\\\\[^btnfr/\"\\\\\\n]",
|
||||
"name": "invalid.illegal.escape.gdresource"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "support.function.any-method.gdresource",
|
||||
"match": "\"res:\\/\\/[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\""
|
||||
},
|
||||
{
|
||||
"name": "support.class.library.gdresource",
|
||||
"match": "(?<=type=)\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\""
|
||||
},
|
||||
{
|
||||
"name": "constant.character.escape.gdresource",
|
||||
"match": "(?<=NodePath\\(|parent=|name=)\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\""
|
||||
},
|
||||
{
|
||||
"name": "string.quoted.double.basic.line.gdresource",
|
||||
"match": "\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"",
|
||||
"patterns": [
|
||||
{
|
||||
"match": "\\\\([btnfr\"\\\\\\n/ ]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})",
|
||||
"name": "constant.character.escape.gdresource"
|
||||
},
|
||||
{
|
||||
"match": "\\\\[^btnfr/\"\\\\\\n]",
|
||||
"name": "invalid.illegal.escape.gdresource"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "invalid.illegal.escape.gdresource",
|
||||
"begin": "'''",
|
||||
"end": "'''"
|
||||
},
|
||||
{
|
||||
"name": "string.quoted.single.literal.line.gdresource",
|
||||
"match": "'.*?'"
|
||||
},
|
||||
{
|
||||
"match": "(?<!\\w)(true|false)(?!\\w)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.language.gdresource"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": "(?<!\\w)([\\+\\-]?(0|([1-9](([0-9]|_[0-9])+)?))(?:(?:\\.(0|([1-9](([0-9]|_[0-9])+)?)))?[eE][\\+\\-]?[1-9]_?[0-9]*|(?:\\.[0-9_]*)))(?!\\w)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.numeric.float.gdresource"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": "(?<!\\w)((?:[\\+\\-]?(0|([1-9](([0-9]|_[0-9])+)?))))(?!\\w)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.numeric.integer.gdresource"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": "(?<!\\w)([\\+\\-]?inf)(?!\\w)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.numeric.inf.gdresource"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": "(?<!\\w)([\\+\\-]?nan)(?!\\w)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.numeric.nan.gdresource"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": "(?<!\\w)((?:0x(([0-9a-fA-F](([0-9a-fA-F]|_[0-9a-fA-F])+)?))))(?!\\w)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.numeric.hex.gdresource"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": "(?<!\\w)(0o[0-7](_?[0-7])*)(?!\\w)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.numeric.oct.gdresource"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": "(?<!\\w)(0b[01](_?[01])*)(?!\\w)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.numeric.bin.gdresource"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"begin": "(?<!\\w)(Vector2|Vector2i|Vector3|Vector3i|Color|Rect2|Rect2i|Array|Basis|Dictionary|Plane|Quat|RID|Rect3|Transform|Transform2D|Transform3D|AABB|String|Color|NodePath|Object|PoolByteArray|PoolIntArray|PoolRealArray|PoolStringArray|PoolVector2Array|PoolVector3Array|PoolColorArray|bool|int|float|StringName|Quaternion|PackedByteArray|PackedInt32Array|PackedInt64Array|PackedFloat32Array|PackedFloat64Array|PackedStringArray|PackedVector2Array|PackedVector2iArray|PackedVector3Array|PackedVector3iArray|PackedColorArray)(\\()\\s?",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "support.class.library.gdresource"
|
||||
}
|
||||
},
|
||||
"end": "\\s?(\\))",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#key_value"
|
||||
},
|
||||
{
|
||||
"include": "#data"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "(?<!\\w)(ExtResource|SubResource)(\\()\\s?",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.control.gdresource"
|
||||
}
|
||||
},
|
||||
"end": "\\s?(\\))",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#key_value"
|
||||
},
|
||||
{
|
||||
"include": "#data"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
19
syntaxes/GDShader.tmLanguage.json
Normal file
19
syntaxes/GDShader.tmLanguage.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"version": "v0.1.0",
|
||||
"scopeName": "source.gdshader",
|
||||
"uuid": "3a95d25d-688b-481f-a581-eee47f00e5ca",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#shader_type"
|
||||
},
|
||||
{
|
||||
"include": "source.glsl"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"shader_type": {
|
||||
"match": "(shader_type)",
|
||||
"name": "storage.type.glsl"
|
||||
}
|
||||
}
|
||||
}
|
||||
11
syntaxes/README.md
Normal file
11
syntaxes/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Helpful resources
|
||||
|
||||
You can find the regex syntax that VSCode uses [here](https://macromates.com/manual/en/regular_expressions).
|
||||
|
||||
## Creating and debugging regex
|
||||
|
||||
When creating regexes it is sometimes useful to test against a data set.
|
||||
|
||||
[Regex101](https://regex101.com/) allows for pretty good match testing. Unfortunately, it does not support the regex (Ruby) version that TextMate uses.
|
||||
|
||||
[ExtendsClass's](https://extendsclass.com/regex-tester.html#ruby) regex engine does support the Ruby variant, but the match testing experience is not as good. However, it automatically generates an FSM for your regex, which is very useful when debugging.
|
||||
202
syntaxes/examples/gdscript1.gd
Normal file
202
syntaxes/examples/gdscript1.gd
Normal file
@@ -0,0 +1,202 @@
|
||||
extends Node
|
||||
class_name TestClass
|
||||
|
||||
# ******************************************************************************
|
||||
|
||||
var a
|
||||
remote var b = 10.0
|
||||
remotesync var c := 20
|
||||
master var d :int = 30
|
||||
puppet var e :int
|
||||
|
||||
signal sig_a
|
||||
signal sig_b()
|
||||
signal sig_c(param1, param2)
|
||||
# signal sig_d(param1: int, param2: Dictionary)
|
||||
# signal sig_e(
|
||||
# param1: int, # first param
|
||||
# param2: Dictionary,
|
||||
# )
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
var f = 40 setget set_f
|
||||
func set_f(value):
|
||||
pass
|
||||
|
||||
var g:int setget set_g, get_g
|
||||
func set_g(value: int=0) -> void:
|
||||
pass
|
||||
|
||||
var h:float = 1.0 setget set_h, get_h
|
||||
func set_h(value: int=0) -> void:
|
||||
pass
|
||||
|
||||
func get_g() -> int:
|
||||
return 0
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
func func_a(param1, param2, param3):
|
||||
self.test()
|
||||
$Node.get_node('Foo')
|
||||
$Node.has_node('Foo')
|
||||
$Node.find_node('Foo')
|
||||
$Node.get_node_or_null('Foo')
|
||||
print($Node.has_node('Foo'))
|
||||
print(NodePath('Foo'))
|
||||
print(NodePath("Foo"))
|
||||
pass
|
||||
|
||||
func func_b(param1, param2=func_a(10, 1.0, 'test')) -> void:
|
||||
pass
|
||||
|
||||
func func_b1(param1 = false, param2: bool = false, param3 := false):
|
||||
pass
|
||||
|
||||
func func_b2(param1 = 10, param2: int = 100, param3 := 1000):
|
||||
pass
|
||||
|
||||
func func_b3(param1 = 1.0, param2: float = 10.0, param3 := 100.001):
|
||||
pass
|
||||
|
||||
func func_b4(param1 = 'foo', param2: String = 'bar', param3 := 'foobar'):
|
||||
pass
|
||||
|
||||
func func_b5(
|
||||
param1 = 'foo', # comment
|
||||
param2: String = 'bar',
|
||||
param3: float = 3.14159,
|
||||
param4:='foobar',
|
||||
param5:=1000,
|
||||
param6:=[],
|
||||
param7:={},
|
||||
param8:=func_a(),
|
||||
param9:=Vector2(0, 1),
|
||||
param10:=Vector2(0, 0),
|
||||
param11:=Color(1, 1, 1, 0.5),
|
||||
param12:=NodePath('Foo')
|
||||
) -> void:
|
||||
pass
|
||||
|
||||
var dict = {
|
||||
a = 0,
|
||||
b = 0.0,
|
||||
c = 'test',
|
||||
}
|
||||
|
||||
func func_c(
|
||||
param1: int = 10,
|
||||
param2 := 1.0,
|
||||
param3: String = 'string',
|
||||
param4 := {a=0, b=0.0, c='test'}
|
||||
):
|
||||
pass
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
var q = "double quotes"
|
||||
var r = 'single quotes'
|
||||
var s = """
|
||||
triple double quotes
|
||||
"""
|
||||
var t = '''triple single quotes''' # this should be red because it's invalid
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
var IS_CONSTANT
|
||||
var not_CONSTANT
|
||||
var ALSO_NOT_constant
|
||||
var CONSTANT_not
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
onready var node_a = $Child
|
||||
onready var node_b = $Child/GrandChild
|
||||
onready var node_bb = $Child/GrandChild/GreatGrandChild
|
||||
onready var node_bbb = $Child/GrandChild/GreatGrandChild/GreatGreatGrandChild
|
||||
onready var node_c = $"../Sibling"
|
||||
onready var node_cc = $'../Sibling'
|
||||
onready var node_d = $'..' # parent
|
||||
onready var node_e = $"../.." # grandparent
|
||||
|
||||
onready var node_f = get_node('Child')
|
||||
onready var node_g = get_node("Child/GrandChild")
|
||||
onready var node_h = get_node("../Sibling")
|
||||
|
||||
if has_node('Child') and get_node('Child').has_node('GrandChild'):
|
||||
pass
|
||||
|
||||
onready var node_i = $badlyNamedChild
|
||||
onready var node_j = $badlyNamedChild/badly_named_grandchild
|
||||
|
||||
var node_path_a = NodePath("Child")
|
||||
var node_path_b = NodePath('Child/GrandChild')
|
||||
var node_path_c = NodePath('../Sibling')
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
var _script = GDScript.new()
|
||||
|
||||
var directions = [
|
||||
Vector2.UP,
|
||||
Vector2.DOWN,
|
||||
Vector2.LEFT,
|
||||
Vector2.RIGHT,
|
||||
]
|
||||
|
||||
enum test_enum {
|
||||
VALUE_1,
|
||||
VALUE_2,
|
||||
VALUE_3,
|
||||
}
|
||||
|
||||
export(test_enum) var enum_variable = test_enum.VALUE_1
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
func if_test():
|
||||
var some_bool := true
|
||||
|
||||
while some_bool:
|
||||
pass
|
||||
while (some_bool):
|
||||
pass
|
||||
|
||||
if some_bool:
|
||||
return some_bool
|
||||
|
||||
if (some_bool):
|
||||
return (some_bool)
|
||||
elif !some_bool:
|
||||
return !some_bool
|
||||
elif !(some_bool):
|
||||
return !(some_bool)
|
||||
elif (some_bool):
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
class InnerClass:
|
||||
var some_var = 100
|
||||
var dict = {
|
||||
'key_a': some_var,
|
||||
'key_b': str(10),
|
||||
key_c = some_var,
|
||||
key_d = int('10'),
|
||||
key_e = Color(1, 1, 1),
|
||||
key_f = Vector2(10, -10)
|
||||
}
|
||||
|
||||
func _ready():
|
||||
if true and true:
|
||||
pass
|
||||
elif false:
|
||||
while true:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
|
||||
pass
|
||||
Reference in New Issue
Block a user