-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit eca85d5
Showing
39 changed files
with
3,191 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
|
||
- package-ecosystem: "npm" | ||
directory: "/server" | ||
schedule: | ||
interval: "daily" | ||
groups: | ||
vscode: | ||
patterns: | ||
- "vscode*" | ||
|
||
- package-ecosystem: "npm" | ||
directory: "/client" | ||
schedule: | ||
interval: "daily" |
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,27 @@ | ||
name: Build | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
tests: | ||
name: JavaScript Test Action | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node: [20] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: 'yarn' | ||
|
||
- name: Yarn install | ||
run: yarn install | ||
|
||
- name: Yarn build | ||
run: yarn build |
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 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
publish: | ||
name: Publish VSCode extension | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: 'yarn' | ||
|
||
- name: Yarn install | ||
run: yarn install | ||
|
||
- name: Yarn build | ||
run: yarn build | ||
|
||
- name: Publish | ||
run: yarn run deploy | ||
env: | ||
VSCE_PAT: ${{ secrets.VSCE_PAT }} |
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,11 @@ | ||
client/out/ | ||
server/out/ | ||
node_modules/ | ||
|
||
.vscode-test/ | ||
|
||
*.vsix | ||
*.tgz | ||
*~ | ||
|
||
.DS_Store |
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 @@ | ||
20.11.1 |
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,25 @@ | ||
.gitignore | ||
.eslintrc | ||
.eslintignore | ||
.prettierrc.json | ||
.node-version | ||
|
||
**/*.ts | ||
**/*.map | ||
**/tsconfig.json | ||
**/tsconfig.base.json | ||
|
||
.vscode/** | ||
.github/** | ||
scripts/** | ||
|
||
client/node_modules/** | ||
!client/node_modules/vscode-jsonrpc/** | ||
!client/node_modules/vscode-languageclient/** | ||
!client/node_modules/vscode-languageserver-protocol/** | ||
!client/node_modules/vscode-languageserver-types/** | ||
!client/node_modules/brace-expansion/** | ||
!client/node_modules/balanced-match/** | ||
!client/node_modules/lru-cache/** | ||
!client/node_modules/yallist/** | ||
!client/node_modules/semver/** |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Marco Roth | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,40 @@ | ||
# Turbo LSP | ||
|
||
Intelligent Turbo tooling for Visual Studio Code | ||
|
||
 | ||
|
||
## Functionality | ||
|
||
Currently, this Language Server only works for HTML, though its utility extends to various file types such as ERB, PHP, or Blade files. | ||
|
||
### Completions | ||
|
||
* Completions for Turbo HTML Custom Elements | ||
* Completions for Turbo HTML Custom Element Attributes | ||
|
||
## Structure | ||
|
||
``` | ||
. | ||
├── package.json // The extension manifest. | ||
| | ||
├── client // Language Client | ||
│ └── src | ||
│ └── extension.ts // Language Client entry point | ||
| | ||
└── server // Language Server | ||
└── src | ||
└── server.ts // Language Server entry point | ||
``` | ||
|
||
## Running the extension locally | ||
|
||
- Run `yarn install` in this folder. This installs all necessary npm modules in both the client and server folder | ||
- Open VS Code on this folder. | ||
- Press Ctrl+Shift+B to compile the client and server. | ||
- Switch to the Debug viewlet. | ||
- Select `Launch Client` from the drop down. | ||
- Run the launch config. | ||
- If you want to debug the server as well use the launch configuration `Attach to Server` | ||
- In the [Extension Development Host] instance of VSCode, open a HTML file. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,24 @@ | ||
{ | ||
"name": "vscode-turbo", | ||
"description": "Intelligent Turbo tooling for Visual Studio Code", | ||
"author": "Marco Roth", | ||
"license": "MIT", | ||
"version": "0.0.1", | ||
"publisher": "Marco Roth", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/marcoroth/turbo-lsp" | ||
}, | ||
"engines": { | ||
"vscode": "^1.52.0" | ||
}, | ||
"dependencies": { | ||
"brace-expansion": "^4.0.0", | ||
"minimatch": "^9.0.4", | ||
"vscode-languageclient": "^9.0.1" | ||
}, | ||
"devDependencies": { | ||
"@types/vscode": "^1.52.0", | ||
"typescript": "^5.4.5" | ||
} | ||
} |
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,90 @@ | ||
import * as path from "path" | ||
|
||
import { workspace, ExtensionContext } from "vscode" | ||
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from "vscode-languageclient/node" | ||
|
||
export class Client { | ||
private client: LanguageClient | ||
private serverModule: string | ||
private languageClientId = "languageServerTurbo" | ||
private languageClientName = "Turbo LSP" | ||
private context: ExtensionContext | ||
|
||
constructor(context: ExtensionContext) { | ||
this.context = context | ||
|
||
this.serverModule = context.asAbsolutePath(path.join("server", "out", "server.js")) | ||
|
||
this.client = new LanguageClient( | ||
this.languageClientId, | ||
this.languageClientName, | ||
this.serverOptions, | ||
this.clientOptions, | ||
) | ||
} | ||
|
||
async start() { | ||
try { | ||
this.client.start() | ||
} catch (error: any) { | ||
console.error(`Error restarting the server: ${error.message}`) | ||
return | ||
} | ||
} | ||
|
||
async stop(): Promise<void> { | ||
if (this.client) { | ||
await this.client.stop() | ||
} | ||
} | ||
|
||
async sendNotification(method: string, params: any) { | ||
return await this.client.sendNotification(method, params) | ||
} | ||
|
||
async sendRequest<T>(method: string, params: any) { | ||
return await this.client.sendRequest<T>(method, params) | ||
} | ||
|
||
// The debug options for the server | ||
// --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging | ||
private get debugOptions() { | ||
return { | ||
execArgv: ["--nolazy", "--inspect=6009"], | ||
} | ||
} | ||
|
||
// If the extension is launched in debug mode then the debug server options are used | ||
// Otherwise the run options are used | ||
private get serverOptions(): ServerOptions { | ||
return { | ||
run: { | ||
module: this.serverModule, | ||
transport: TransportKind.ipc, | ||
}, | ||
debug: { | ||
module: this.serverModule, | ||
transport: TransportKind.ipc, | ||
options: this.debugOptions, | ||
}, | ||
} | ||
} | ||
|
||
private get clientOptions(): LanguageClientOptions { | ||
return { | ||
documentSelector: [ | ||
{ scheme: "file", language: "ruby" }, | ||
{ scheme: "file", language: "erb" }, | ||
{ scheme: "file", language: "blade" }, | ||
{ scheme: "file", language: "php" }, | ||
{ scheme: "file", language: "html" }, | ||
{ scheme: "file", language: "javascript" }, | ||
{ scheme: "file", language: "typescript" }, | ||
], | ||
synchronize: { | ||
// Notify the server about file changes to '.clientrc files contained in the workspace | ||
fileEvents: workspace.createFileSystemWatcher("**/.clientrc"), | ||
}, | ||
} | ||
} | ||
} |
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,18 @@ | ||
import { ExtensionContext } from "vscode" | ||
import { Client } from "./client" | ||
|
||
let client: Client | ||
|
||
export async function activate(context: ExtensionContext) { | ||
client = new Client(context) | ||
|
||
await client.start() | ||
} | ||
|
||
export async function deactivate(): Promise<void> { | ||
if (client) { | ||
await client.stop() | ||
} else { | ||
return undefined | ||
} | ||
} |
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,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"target": "es2019", | ||
"lib": ["ES2019"], | ||
"outDir": "out", | ||
"rootDir": "src", | ||
"sourceMap": true | ||
}, | ||
"include": ["src"], | ||
"exclude": ["node_modules"] | ||
} |
Oops, something went wrong.