-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support multiple workspaces/clients in Parcel for VSCode (#9278)
* Add vscode workspace setting Disable js/ts validation for the workspace (packages that have .tsconfig should still work) * WIP: detect lsp server in reporter If the server isn't running, the reporter should do nothing. * Update todo doc * Add ideas to todo doc * Fix kitchen-sync example * support multiple workspaces (#9265) * WIP: lsp sentinel watcher * garbage * f * add initial sentinel check to watch * remove event emitter from reporter * update README, add reporter README * support multiple LSP clients - changed reporter project root to used process.cwd - only add client when workspace root matches project root * remove generated files * remove other generated files * move vscode-extension-TODO into extension dir * clean up * remove unused import --------- Co-authored-by: Celina Peralta <cperalta@atlassian.com> * remove examples changes * revert html example changes * move development info to CONTRIBUTING.md * Remove log Co-authored-by: Eric Eldredge <lettertwo@gmail.com> * Update packages/reporters/lsp-reporter/src/LspReporter.js Co-authored-by: Eric Eldredge <lettertwo@gmail.com> * Update packages/reporters/lsp-reporter/src/LspReporter.js Co-authored-by: Eric Eldredge <lettertwo@gmail.com> * Update packages/utils/parcel-lsp/src/LspServer.ts Co-authored-by: Eric Eldredge <lettertwo@gmail.com> * Update packages/utils/parcel-lsp/src/LspServer.ts Co-authored-by: Eric Eldredge <lettertwo@gmail.com> * Update packages/reporters/lsp-reporter/src/LspReporter.js Co-authored-by: Eric Eldredge <lettertwo@gmail.com> * Update packages/utils/parcel-lsp/src/LspServer.ts Co-authored-by: Eric Eldredge <lettertwo@gmail.com> * Update packages/reporters/lsp-reporter/src/LspReporter.js Co-authored-by: Eric Eldredge <lettertwo@gmail.com> * Update packages/utils/parcel-lsp/src/LspServer.ts Co-authored-by: Eric Eldredge <lettertwo@gmail.com> * add sentinel file cleanup * Apply suggestions from code review * linting --------- Co-authored-by: Eric Eldredge <lettertwo@gmail.com> Co-authored-by: Brian Tedder <6571474+imbrian@users.noreply.github.com> Co-authored-by: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
- Loading branch information
1 parent
808edd8
commit e92ba6c
Showing
8 changed files
with
214 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# LSP Reporter | ||
|
||
This reporter is for sending diagnostics to a running [LSP server](../../utils/parcel-lsp/). This is inteded to be used alongside the Parcel VS Code extension. | ||
|
||
It creates an IPC server for responding to requests for diagnostics from the LSP server, and pushes diagnostics to the LSP server. | ||
|
||
## Usage | ||
|
||
This reporter is run with Parcel build, watch, and serve commands by passing `@parcel/reporter-lsp` to the `--reporter` option. | ||
|
||
```sh | ||
parcel serve --reporter @parcel/reporter-lsp | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
## Development Debugging | ||
|
||
1. Go to the Run and Debug menu in VSCode | ||
2. Select "Launch Parcel for VSCode Extension" | ||
3. Specify in which project to run the Extension Development Host in `launch.json`: | ||
|
||
``` | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"args": [ | ||
"${workspaceFolder}/packages/examples/kitchen-sink", // Change this project | ||
"--extensionDevelopmentPath=${workspaceFolder}/packages/utils/parcelforvscode" | ||
], | ||
"name": "Launch Parcel for VSCode Extension", | ||
"outFiles": [ | ||
"${workspaceFolder}/packages/utils/parcelforvscode/out/**/*.js" | ||
], | ||
"preLaunchTask": "Watch VSCode Extension", | ||
"request": "launch", | ||
"type": "extensionHost" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
4. Run a Parcel command (e.g. `parcel server --reporter @parcel/reporter-lsp`) in the Extension Host window. | ||
5. Diagnostics should appear in the Extension Host window in the Problems panel (Shift + CMD + m). | ||
6. Output from the extension should be available in the Output panel (Shift + CMD + u) in the launching window. | ||
|
||
## Packaging | ||
|
||
1. Run `yarn package`. The output is a `.vsix` file. | ||
2. Run `code --install-extension parcel-for-vscode-<version>.vsix` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Packages: | ||
|
||
- [@parcel/reporter-lsp](./packages/reporters/lsp-reporter/) | ||
- [parcel-for-vscode](./packages/utils/parcelforvscode/) | ||
- [@parcel/lsp](./packages/utils/parcel-lsp/) | ||
- [@parcel/lsp-protocol](./packages/utils/parcel-lsp-protocol) | ||
|
||
TODO: | ||
|
||
- [x] need to not wait for connections | ||
- [x] language server shuts down and kills our process when the extension is closed | ||
- [x] handle the case where parcel is started after the extension is running | ||
- [x] handle the case where extension is started while parcel is running | ||
- [x] support multiple parcels | ||
- [x] show prior diagnostics on connection | ||
- [x] only connect to parcels that match the workspace | ||
- [ ] show parcel diagnostic hints | ||
- [ ] implement quick fixes (requires Parcel changes?) | ||
- [x] cleanup LSP server sentinel when server shuts down | ||
- [x] support multiple LSP servers (make sure a workspace only sees errors from its server) | ||
- [x] cleanup the lsp reporter's server detection (make async, maybe use file watcher) | ||
- [ ] make @parcel/reporter-lsp part of default config or otherwise always installed | ||
(or, move the reporter's behavior into core) | ||
|
||
Ideas: | ||
|
||
- a `parcel lsp` cli command to replace/subsume the standalone `@parcel/lsp` server | ||
- this could take on the complexities of decision making like automatically | ||
starting a Parcel build if one isn’t running, or sharing an LSP server | ||
for the same parcel project with multiple workspaces/instances, etc. | ||
- integrating the behavior of `@parcel/reporter-lsp` into core | ||
or otherwise having the reporter be 'always on' or part of default config |
This file was deleted.
Oops, something went wrong.