Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/moody-eyes-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/packages/labs/vscode-extension"
"--extensionDevelopmentPath=${workspaceFolder}/packages/labs/vscode-extension",
"--disable-extensions"
],
"outFiles": [
"${workspaceFolder}/packages/labs/vscode-extension/out/**/*.{js|cjs}"
Expand Down
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/labs/tsserver-plugin/src/index.cts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ const init: ts.server.PluginModuleFactory & {loadedPromise: Promise<void>} = ({
create(info: ts.server.PluginCreateInfo) {
const {logger} = info.project.projectService;

// TODO (justinfagnani): Figure out where this logs to or remove.
console.log('tsserver-plugin create()');

// eslint-disable-next-line @typescript-eslint/no-explicit-any
if ((info.languageService as any)[litLanguageServiceApplied] === true) {
logger.info(
Expand Down
21 changes: 17 additions & 4 deletions packages/labs/vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
"Snippets",
"Linters"
],
"activationEvents": [],
"activationEvents": [
"onLanguage:javascript",
"onLanguage:javascriptreact",
"onLanguage:typescript",
"onLanguage:typescriptreact"
],
"main": "./extension.cjs",
"contributes": {
"configuration": {
Expand All @@ -24,6 +29,12 @@
"command": "lit.hello",
"title": "Hello Lit"
}
],
"typescriptServerPlugins": [
{
"name": "@lit-labs/tsserver-plugin",
"enableForWorkspaceTypeScriptVersions": true
}
]
},
"scripts": {
Expand All @@ -36,7 +47,8 @@
"test:vscode": "wireit"
},
"dependencies": {
"@lit-labs/analyzer": "^0.13.2"
"@lit-labs/analyzer": "^0.13.2",
"@lit-labs/tsserver-plugin": "^0.0.1"
},
"devDependencies": {
"@types/node": "^22.17.0",
Expand All @@ -48,10 +60,11 @@
"build": {
"command": "tsc --pretty",
"dependencies": [
"../analyzer:build"
"../analyzer:build",
"../tsserver-plugin:build"
],
"files": [
"src/**/*.ts",
"src/**/*.{ts,cts}",
"tsconfig.json"
],
"output": [
Expand Down
19 changes: 19 additions & 0 deletions packages/labs/vscode-extension/src/lib/lit-extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@ export class LitExtension {

const {context} = this;

// Begin: Try to force our tsserver-plugin to show diagnostics automatically
const extension = vscode.extensions.getExtension(
'vscode.typescript-language-features'
);
if (extension === undefined) {
logChannel.appendLine(
'Could not find vscode.typescript-language-features'
);
return;
}

await extension.activate();
if (extension.exports.getAPI) {
logChannel.appendLine('Configuring @lit-labs/tsserver-plugin');
const api = extension.exports.getAPI(0);
api.configurePlugin('@lit-labs/tsserver-plugin', {});
}
// End: Try to force our tsserver-plugin to show diagnostics automatically

// lit.hello command
const disposable = vscode.commands.registerCommand('lit.hello', () => {
logChannel.appendLine('lit.hello');
Expand Down
Loading