Skip to content

Commit

Permalink
Various QoL Improvements (#529)
Browse files Browse the repository at this point in the history
* Updated Godot icons (and removed old ones)
* Improve "Debug Pinned Scene" command by making the pinned scene persist between VSCode sessions
* Fix scene file highlighting not working 
* Fix ScenePreview not working in Godot 3
* Add buttons for relevant actions to ScenePreview items
* Add internal document links for SubResource() and ExtResource() statements in scene files
* Add hover for SubResource() and ExtResource() statements in scene files
* Improve ability to right click -> open docs for methods of builtin types (doesn't always work)
* Add a file decorator to show the pinned debug file in the filesystem view/editor tabs
* Add item decorators to the Scene Preview to show Node attributes more clearly
* Updated readme
* Overhauled documentation viewer
* Added GDScript formatter
* Add (disabled) experimental providers for custom completions, semantic tokens, and tasks
* Lots of internal refactoring
  • Loading branch information
DaelonSuzuka authored Dec 6, 2023
1 parent f65033c commit e7e2d04
Show file tree
Hide file tree
Showing 1,090 changed files with 6,554 additions and 5,368 deletions.
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
out
node_modules
server
publish/*.vsix
test
*.vsix
configurations/tmp.txt
configurations/test.py
.vscode-test
workspace.code-workspace
9 changes: 9 additions & 0 deletions .vscode-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { defineConfig } = require('@vscode/test-cli');

module.exports = defineConfig(
{
// version: '1.84.0',
label: 'unitTests',
files: 'out/**/*.test.js',
}
);
5 changes: 3 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/workspace.code-workspace",
"--extensionDevelopmentPath=${workspaceFolder}"
"--profile=temp",
"--extensionDevelopmentPath=${workspaceFolder}",
"${workspaceFolder}/workspace.code-workspace"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
Expand Down
5 changes: 3 additions & 2 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
*
*/**
**/*.js.map
!out/extension.js
!syntaxes/
!syntaxes/*.tmLanguage.json
!resources/
!media/
!configurations/
syntaxes/examples
!package.json
!package.nls.json
!README.md
Expand Down
39 changes: 39 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Contributing

### Building from source

#### Requirements

- [npm](https://www.npmjs.com/get-npm)

#### 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 `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.

Additionally, if you create a `workspace.code-workspace` file, you can use the **Run Extension with workspace file** launch configuration to quickly change what folder your Extension Host is running in, and quickly change the settings passed to the debug environment

An example `workspace.code-workspace` file:
```jsonc
{
"folders": [
{
// "path": "."
"path": "P:/project1"
// "path": "P:/project2"
// "path": "P:/folder/project3"
}
],
"settings": {
"godotTools.editorPath.godot3": "godot3.dev.exe",
"godotTools.editorPath.godot4": "godot4.dev.exe",
// "godotTools.editorPath.godot4": "godot4.custom.exe"
// "godotTools.editorPath.godot4": "Godot_v4.1.1-stable_win64.exe",
"godotTools.lsp.headless": false
}
}
```
167 changes: 103 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,64 @@
# Godot Tools

A complete set of tools to code games with
[Godot Engine](http://www.godotengine.org/) in Visual Studio Code.
Game development tools for working with [Godot Engine](http://www.godotengine.org/) in Visual Studio Code.

**IMPORTANT NOTE:** Versions 1.0.0 and later of this extension only support
Godot 3.2 or later.

## Features

The extension comes with a wealth of features to make your Godot programming
experience as comfortable as possible:

- Syntax highlighting for the GDScript (`.gd`) language
- Syntax highlighting for the `.tscn` and `.tres` scene formats
- Syntax highlighting for the `.gdshader` shader format
- Full typed GDScript support
- Optional "Smart Mode" to improve productivity with dynamically typed scripts
- Function definitions and documentation display on hover (see image below)
- Rich autocompletion
- Switch from a `.gd` file to the related `.tscn` file (default keybind is `alt+o`)
- In-editor Scene Preview
- Display script warnings and errors
- Ctrl + click on a variable or method call to jump to its definition
- Full documentation of the Godot Engine's API supported (select *Godot Tools: List native classes of Godot* in the Command Palette)
- Run a Godot project from VS Code
- Debug your GDScript-based Godot project from VS Code with breakpoints, step-in/out/over, variable watch, call stack, and active scene tree

![Showing the documentation on hover feature](img/godot-tools.png)

## Download
- [Godot Tools](#godot-tools)
- [Features](#features)
- [Download](#download)
- [Commands](#commands)
- [Configuration](#configuration)
- [Godot Editor](#godot-editor)
- [VS Code](#vs-code)
- [GDScript Debugger](#gdscript-debugger)
- [*Configurations*](#configurations)
- [Issues and contributions](#issues-and-contributions)
- [Contributing](#contributing)
- [FAQ](#faq)
- [Why does it fail to connect to the language server?](#why-does-it-fail-to-connect-to-the-language-server)
- [Why isn't IntelliSense displaying script members?](#why-isnt-intellisense-displaying-script-members)


# Features

(**bold items** are new in Godot Tools `v2.0.0`)
- **ALL FEATURES FULLY SUPPORT GODOT 4**
- GDScript (`.gd`) language features:
- syntax highlighting
- `ctrl+click` on any symbol to jump to its definition or **open its documentation**
- `ctrl+click` on `res://resource/path` links
- **hover previews on `res://resource/path` links**
- autocompletions
- full typed GDScript support
- optional "Smart Mode" to improve productivity with dynamically typed scripts
- Hover previews show function/variable definitions including doc-comments
- **switch from a `.gd` file to the related `.tscn` file (default keybind is `alt+o`)**
- display script warnings and errors
- GDScript Debugger features:
- **completely rewritten, greatly improved reliability**
- **new, simple configuration** (seriously, just hit F5!)
- **convenient launch targets: current project/current file/pinned file**,
- breakpoints
- exceptions
- step-in/out/over
- variable watch
- call stack
- active scene tree
- inspector
- GDResource (`.tscn` and `.tres`) language features:
- syntax highlighting
- **`ctrl+click` on `res://resource/path` links**
- **`ctrl+click` on symbols to jump to its definition or open its documentation**
- **hover previews show definitions of External and Sub Resources**
- **hover previews on `res://resource/path` links**
- **inlay hints to help visualize External and Sub Resources**
- **in-editor Scene Preview**
- GDShader (`.gdshader`) language features:
- syntax highlighting

# Download

- [Visual Studio Marketplace **(recommended)**](https://marketplace.visualstudio.com/items?itemName=geequlim.godot-tools)
- Stable release, with support for automatic updates.
Expand All @@ -42,32 +72,32 @@ 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
# Commands

The extension adds a few entries to the VS Code Command Palette under "Godot Tools":

- Open workspace with Godot editor
- Run the workspace as a Godot project
- List Godot's native classes
- List Godot's native classes (and open thier documentation)
- Debug the current `.tscn`/`.gd` file
- Debug the pinned `.tscn`/`.gd` file
- Pin/Unpin the current `.tscn`/`.gd` file for debugging
- Open the pinned file

## Configuration
# Configuration

### Godot
### Godot Editor

If you like this extension, you can set VS Code as your default script editor
for Godot by following these steps:
You can set VS Code as your default script editor for Godot by following these steps:

1. Open the **Editor Settings**
2. Select **Text Editor > External**
3. Make sure the **Use External Editor** box is checked
3. Check **Use External Editor**
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

#### Settings

You can use the following settings to configure Godot Tools:

- `godotTools.editorPath.godot3`
Expand All @@ -79,7 +109,7 @@ The path to the Godot editor executable. _Under Mac OS, this is the executable i

When using Godot >3.6 or >4.2, Headless LSP mode is available. In Headless mode, the extension will attempt to launch a windowless instance of the Godot editor to use as its Language Server.

#### GDScript Debugger
# GDScript Debugger

The debugger is for GDScript projects. To debug C# projects, use [C# Tools for Godot](https://github.com/godotengine/godot-csharp-vscode).

Expand All @@ -97,22 +127,44 @@ To configure the GDScript debugger:

### *Configurations*

_Required_

None: seriously. This is valid debugging configuration:

Minimal:
```json
{ "name": "Launch", "type": "godot" }
{
"name": "Launch",
"type": "godot",
"request": "launch"
}
```

_Optional_
Everything:
```json
{
"name": "Launch",
"type": "godot",
"request": "launch",
"project": "${workspaceFolder}",
"address": "127.0.0.1",
"port": 6007,
"scene": "main|current|pinned|<path>",
"editor_path": "<path>",
// engine command line flags
"profiling": false,
"single_threaded_scene": false,
"debug_collisions": false,
"debug_paths": false,
"debug_navigation": false,
"debug_avoidance": false,
"debug_stringnames": false,
"frame_delay": 0,
"time_scale": 1.0,
"disable_vsync": false,
"fixed_fps": 60,
// anything else
"additional_options": ""
}
```

`project`: Absolute path to a directory with a project.godot file. Defaults to the currently open VSCode workspace with `${workspaceFolder}`.
`port`: The port number for the Godot remote debugger to use.
`address`: The IP address for the Godot remote debugger to use.
`scene_file`: Path to a scene file to run instead of the projects 'main scene'.
`editor_path`: Absolute path to the Godot executable to be used for this debug profile.
`additional_options`: Additional command line arguments.
Godot's command flags are documented here: https://docs.godotengine.org/en/stable/tutorials/editor/command_line_tutorial.html

*Usage*

Expand All @@ -132,29 +184,16 @@ and create pull requests anytime.
See the [full changelog](https://github.com/GodotExplorer/godot-tools/blob/master/CHANGELOG.md)
for the latest changes.

### Building from source

#### Requirements

- [npm](https://www.npmjs.com/get-npm)

#### 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 `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.
# Contributing

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.
see [CONTRIBUTING.md](CONTRIBUTING.md)

## FAQ

### Why does it fail to connect to the language server?

- Godot 3.2 or later is required.
- For Godot 4, the [`gdscript_lsp_server_port` setting](#gdscript_lsp_server_port)
must be changed to `6005` to match the Godot editor's new default
language server port number.
- Make sure the Godot editor is running
- Make sure to open the project in the Godot editor first. If you opened
the editor after opening VS Code, you can click the **Retry** button
in the bottom-right corner in VS Code.
Expand Down
24 changes: 0 additions & 24 deletions configurations/gdresource-configuration.json

This file was deleted.

24 changes: 24 additions & 0 deletions configurations/gdresource.language-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"comments": {
"lineComment": ";"
},
"brackets": [
["(", ")"],
["[", "]"],
["{", "}"]
],
"autoClosingPairs": [
["'", "'"],
["\"", "\""],
["(", ")"],
["[", "]"],
["{", "}"]
],
"surroundingPairs": [
["'", "'"],
["\"", "\""],
["(", ")"],
["[", "]"],
["{", "}"]
]
}
Loading

0 comments on commit e7e2d04

Please sign in to comment.