-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from Myzel394/vs-code-extension
feat: Add build script for vs code extension
- Loading branch information
Showing
14 changed files
with
589 additions
and
71 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
Empty file.
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 was deleted.
Oops, something went wrong.
Empty file.
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 |
---|---|---|
@@ -1,27 +1,21 @@ | ||
# LSP Example for Embedded Language using Language Service | ||
# config-lsp for VS Code | ||
|
||
Heavily documented sample code for https://code.visualstudio.com/api/language-extensions/embedded-languages#language-services | ||
`config-lsp` provides language support for various config files. | ||
Currently it supports completions, diagnostics, hints, formatting, hover information, | ||
and definition requests. | ||
|
||
## Functionality | ||
Install this extension and load your config files in VS Code to get started. | ||
|
||
This extension contributes a new language, `html1`. The new language is for illustration purpose and has basic syntax highlighting. | ||
If `config-lsp` is unable to detect the language of your config file, you can manually | ||
specify it by adding a line in the form of: | ||
|
||
This Language Server works for `html1` file. HTML1 is like HTML file but has file extension `.html1`. You can create a `test.html1` file to play with below functionalities: | ||
```plaintext | ||
#?lsp.language=<language> | ||
- Completions for HTML tags | ||
- Completions for CSS in `<style>` tag | ||
- Diagnostics for CSS | ||
# For example | ||
## Running the Sample | ||
#?lsp.language=sshconfig | ||
#?lsp.language=fstab | ||
#?lsp.language=aliases | ||
``` | ||
|
||
- Run `npm 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 document | ||
- Type `<d|` to try HTML completion | ||
- Type `<style>.foo { c| }</style>` to try CSS completion | ||
- Have `<style>.foo { }</style>` to see CSS Diagnostics |
This file was deleted.
Oops, something went wrong.
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,57 @@ | ||
const esbuild = require('esbuild'); | ||
|
||
const production = process.argv.includes('--production'); | ||
const watch = process.argv.includes('--watch'); | ||
|
||
async function main() { | ||
const ctx = await esbuild.context({ | ||
entryPoints: ['src/extension.ts'], | ||
bundle: true, | ||
format: 'cjs', | ||
minify: production, | ||
sourcemap: !production, | ||
sourcesContent: false, | ||
platform: 'node', | ||
outfile: 'out/extension.js', | ||
external: ['vscode'], | ||
logLevel: 'silent', | ||
// According to https://github.com/ewanharris/vscode-versions, VS Code ships with NodeJS version 16.14.2 | ||
// and according to https://node.green/ this version supports ES2022. | ||
target: "es2022", | ||
plugins: [ | ||
/* add to the end of plugins array */ | ||
esbuildProblemMatcherPlugin | ||
] | ||
}); | ||
if (watch) { | ||
await ctx.watch(); | ||
} else { | ||
await ctx.rebuild(); | ||
await ctx.dispose(); | ||
} | ||
} | ||
|
||
/** | ||
* @type {import('esbuild').Plugin} | ||
*/ | ||
const esbuildProblemMatcherPlugin = { | ||
name: 'esbuild-problem-matcher', | ||
|
||
setup(build) { | ||
build.onStart(() => { | ||
console.log('[watch] build started'); | ||
}); | ||
build.onEnd(result => { | ||
result.errors.forEach(({ text, location }) => { | ||
console.error(`✘ [ERROR] ${text}`); | ||
console.error(` ${location.file}:${location.line}:${location.column}:`); | ||
}); | ||
console.log('[watch] build finished'); | ||
}); | ||
} | ||
}; | ||
|
||
main().catch(e => { | ||
console.error(e); | ||
process.exit(1); | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.