Thanks for contributing to gltf-vscode!
Contributions to this repository should follow the same general guidelines as the main Cesium CONTRIBUTING guide.
Before we can merge a pull request, we require a signed Contributor License Agreement. There is a CLA for:
- individuals and
- corporations.
This only needs to be completed once, and enables contributions to all of the projects under the Analytical Graphics Inc organization. The CLA ensures you retain copyright to your contributions, and provides us the right to use, modify, and redistribute your contributions using the Apache 2.0 License.
Please email a completed CLA with all fields filled in to [email protected]. Related questions are also welcome.
VSCode itself is used for developing and debugging its own extensions.
Please install the ESLint extension by Dirk Baeumer into VSCode.
You will also need NodeJS installed, for npm package management.
- Use
git
to clone this repository to a local disk. - Open a shell and run
npm install
in the root folder of the cloned repository, to install npm packages. - Launch VSCode and click "Open Folder" on the root of the cloned repository.
- Press CTRL - P to open the task bar, and type
task watch
to launch the watch task.
NOTE: It is important to launch the watch task every time you close and re-open VSCode. The extension has two parts now,
a main part called the "client" and a separate process called the "glTF Language Server." If you don't
manually start the build watcher, the client might be built without the server, and you will see an error. When the watch
task is running, you will see a tiny icon in the bottom status bar with the number 2
next to a wrench-and-screwdriver
icon. There are 2 watchers, one for the client and one for the server. If you only see 1
here, one of the watchers
is not running.
To launch the debugger, press F5. This will open a second copy of VSCode, with a built-from-source version of the extension installed. If you already have the glTF extension from the marketplace installed, there will be an info message letting you know that the built version has overwritten it for just the debugger session.
Please add bullet point(s) for changes or new features to the top of CHANGELOG.md
. The publish date can be left as UNRELEASED
since
the release is not on any set schedule, and likely will not happen on the same day that the pull request is created.
This is tricky, because HTML is previewed inside a sandboxed iframe which is itself inside an embedded webview inside VSCode's Electron-based user interface. Here are the steps:
-
Use the extension to launch the HTML preview window (such as by previewing a glTF model).
-
Click
Help
->Toggle Developer Tools
. Note that this DevTools is docked, and is only for VSCode itself. -
In the Console tab, paste this line:
document.body.querySelector('webview').getWebContents().openDevTools();
-
You now have a second DevTools. This new one is un-docked. Close the old docked one.
-
In the top of the Console tab of the remaining un-docked DevTools, click the pull-down and change
top
toactive-frame (webview.html)
.
Now you can debug the HTML preview in the sandboxed iframe.