-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-write extension to use reactive-vscode, align with Vue extension (#…
…790)
- Loading branch information
Showing
11 changed files
with
718 additions
and
185 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 |
---|---|---|
|
@@ -4,3 +4,5 @@ node_modules | |
lib/ | ||
dist/ | ||
tsconfig.tsbuildinfo | ||
|
||
generated-meta.ts |
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,63 @@ | ||
import { computed, useAllExtensions } from 'reactive-vscode'; | ||
import * as semver from 'semver'; | ||
import * as vscode from 'vscode'; | ||
import { config } from './config'; | ||
|
||
// TODO: does Glint need this concept of "compatible" extensions? | ||
|
||
const defaultCompatibleExtensions = new Set([ | ||
'astro-build.astro-vscode', | ||
'bierner.lit-html', | ||
'Divlo.vscode-styled-jsx-languageserver', | ||
'GitHub.copilot-chat', | ||
'ije.esm-vscode', | ||
'jenkey2011.string-highlight', | ||
'johnsoncodehk.vscode-tsslint', | ||
'kimuson.ts-type-expand', | ||
'miaonster.vscode-tsx-arrow-definition', | ||
'ms-dynamics-smb.al', | ||
'mxsdev.typescript-explorer', | ||
'nrwl.angular-console', | ||
'p42ai.refactor', | ||
'runem.lit-plugin', | ||
'ShenQingchuan.vue-vine-extension', | ||
'styled-components.vscode-styled-components', | ||
'unifiedjs.vscode-mdx', | ||
'VisualStudioExptTeam.vscodeintellicode', | ||
'Vue.volar', | ||
]); | ||
|
||
const extensions = useAllExtensions(); | ||
|
||
export const incompatibleExtensions = computed(() => { | ||
return extensions.value | ||
.filter((ext) => isExtensionCompatibleWithHybridMode(ext) === false) | ||
.map((ext) => ext.id); | ||
}); | ||
|
||
export const unknownExtensions = computed(() => { | ||
return extensions.value | ||
.filter( | ||
(ext) => | ||
isExtensionCompatibleWithHybridMode(ext) === undefined && | ||
!!ext.packageJSON?.contributes?.typescriptServerPlugins, | ||
) | ||
.map((ext) => ext.id); | ||
}); | ||
|
||
function isExtensionCompatibleWithHybridMode( | ||
extension: vscode.Extension<any>, | ||
): boolean | undefined { | ||
if ( | ||
defaultCompatibleExtensions.has(extension.id) || | ||
config.server.compatibleExtensions.includes(extension.id) | ||
) { | ||
return true; | ||
} | ||
if (extension.id === 'denoland.vscode-deno') { | ||
return !vscode.workspace.getConfiguration('deno').get<boolean>('enable'); | ||
} | ||
if (extension.id === 'svelte.svelte-vscode') { | ||
return semver.gte(extension.packageJSON.version, '108.4.0'); | ||
} | ||
} |
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,7 @@ | ||
import { defineConfigObject } from 'reactive-vscode'; | ||
import { NestedScopedConfigs, scopedConfigs } from './generated-meta'; | ||
|
||
export const config = defineConfigObject<NestedScopedConfigs>( | ||
scopedConfigs.scope, | ||
scopedConfigs.defaults, | ||
); |
Oops, something went wrong.