Giter Site home page Giter Site logo

redmser / godot-embed-external-editor Goto Github PK

View Code? Open in Web Editor NEW
58.0 3.0 6.0 228 KB

Embed an external script editor (e.g. VSCode) into the Godot editor.

License: MIT License

Python 17.21% GDScript 33.54% C++ 49.25%
editor godot godot-engine godotengine vscode gdextension

godot-embed-external-editor's Introduction

Godot Embed External Editor

A GDExtension which allows embedding an external code editor such as Visual Studio Code directly into your Godot editor!

Quick Start Guide

Preview Image

Features

  • Automatically attach and detach external code editors.
    • Checks if the code editor is relevant for the given project (e.g. the project folder is opened inside of it) whenever possible.
    • A toggle button in the scene tab bar to manually attach and detach the external code editor.
  • Supported external editors:
    • Only Visual Studio Code for now.

Quick Start

  • Ensure that
    • you are using Godot 4.
    • you are on Windows.
    • in Godot's editor settings, "Single-window mode" is disabled (otherwise dialogs will not appear in front of the code editor).
    • in Godot's editor settings, external code editor is enabled and correctly set up (double-clicking a script file in Godot's file explorer should open your editor of choice).
    • you follow the setup instructions for the editor of your choice.
  • Download and extract the latest build artifact or compile from source.
  • Copy the addons folder into your game project folder.
  • If Godot was running, be sure to select "Project -> Reload Current Project" or restart the editor (GDExtensions are not live reloaded, see this issue).
  • Enable the plug-in in the project settings.
  • Open your code editor by double-clicking a script file in Godot's explorer (unrelated code editors will NOT be embedded by this addon) - it should disappear shortly after launching.
  • Switch to the Script tab and enjoy!

Per-Editor Setup

Visual Studio Code

Following settings changes can either be done in the user settings (Ctrl+Comma), or for each workspace folder:

  • Set window.titleBarStyle to native. Otherwise the titlebar can not be hidden and the editor window will be resizable independently from its container.
  • Ensure that the settings window.title and window.titleSeparator use their default values. Follow these instructions if you have modified them:
    • The window.title setting must contain both the string Visual Studio Code and the name of the currently open folder ${rootName}. This is needed in order for the addon to detect whether the instance has the project opened.
    • Similarly, the window.titleSeparator needs leading and trailing whitespace to work correctly.

If you prefer using Visual Studio Code as a plain text editor without its IDE features, consider using Zen Mode:

  • Set zenMode.centerLayout to false and zenMode.fullScreen to false.
  • Enable Zen Mode by running the command View: Toggle Zen Mode.

Limitations

This addon is very experimental and hacky. I'm trying to improve upon it, but there are some things that can not be fixed as easily:

General

  • Godot still has problems detecting external script file changes (see this issue).
    • Workaround: Restart the editor with "Project -> Reload Current Project".
  • Can not view documentation in editor without detaching editor.
    • Workaround: You can use VSCode's "List native classes" option as an alternative.
  • There has been occasional freezes in the past which I've tried to fix. If they still persist, please open an issue.
    • Workaround: If you get a freeze, it seems like Alt+Tab fixes it most of the time.
  • Editor's titlebar does not show after undocked.
    • Workaround: Minimize and restore the window.
  • The embedded window may get native window borders and be resizable at times (e.g. when the debugger breaks).
    • Workaround: Undock and dock the window again.
  • Keyboard input will only be accepted by whichever window is in focus (e.g. F5 to run the game).
  • Godot does not automatically switch to the script tab.
  • Hover thumbnails for scene tabs do not show in front of the embedded code editor.

Visual Studio Code

  • Until this PR is finished and merged, debugging Godot games through VSCode is not possible.
  • Rarely, a black strip appears at the top of VSCode which offsets all input events
    • Workaround: Restart VSCode to fix this (sadly not even the "Reload Window" command solves this).

Contributing

I don't plan on working on this project for more than my personal use-cases, so I would greatly appreciate help from others to improve upon this extension:

  • Support other OSes like Mac or Linux.
  • Support more editors, including documentation on how to set them up.
  • Fix usability issues and bugs.

Create issues for ideas, feedback or bugs. Open pull requests if you implemented something. All help is appreciated! :)

If you want to say thanks, then you can instead donate on GitHub sponsors.

godot-embed-external-editor's People

Contributors

redmser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

godot-embed-external-editor's Issues

Allow opening documentation in Godot

Try to detect if the currently selected tab is a documentation tab, and hide the embedded window if so.

Not sure how to make it clear to the user how to show the editor again though. Maybe adding another button next to attach/detach to show/hide the window instead?

Linux Support?

Linux Support Maybe in the Future?

Is this addon possible to be used in Linux? (many godot developers, like me, are using Linux)
Please if it is possible, consider supporting it.

Extension configuration

  • Allow customizing the detection, possibly using a UI
    • Per supported editor, include a list of rules which are checked for (window title, executable name, etc.)
    • But user can also edit these rules or add their own
  • Possibly other things to configure, e.g.
    • Update timer frequency
    • Auto-close external editor when Godot is closed
  • Remember if auto-docking is enabled or disabled, instead of forcing it on every time

Hint for Zen Mode

I think the Zen Mode is a good option for someone, who just needs vscode as text editor. Maybe the Readme could mention the possibility.

Settings

  • ZenMode.fullscreen must be false
  • zenMode.centerlayout should be false

Namespacing

  • Rename singleton to more specific name that doesn't imply the OS, like EmbedExternalEditorAPI
  • Rename window_get_vscode_hwnd to window_find_embed_handle since it will handle other editors later

ahk instead of build godot

Hello,
I'm developing JetBrains plugin for Godot and found this addon on redit -> which is exactly what I need, but I don't really like, that I have to build my own Godot from source.
I've tried to overcome this, by using AutoHotKey scripts called from Godot -> so instead of accessing directly WinApi I just call script, which access it for me.

Problem I've could not overcome is, that even after reparenting IntelliJ under the Godot window, it does not accept Inputs.
I can click on line - which get selected, but curor doesn ot appear nor it accepts any keyboard input to edit the script.

Might you have any idea, what this might be causing? I known it's not exactly your problem or your's plugin, but I don't know where else to ask. :)

Not sure if this approach would be ok for you - there are hacks like for not being able to store hwnd for example so I must store it into .txt file, then read it from there and such... but maybe it's worth instead of custom Godot build?

https://gitlab.com/IceExplosive/IntelliGodot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.