Skip to content

Commit

Permalink
Remove support for ruby-based language server
Browse files Browse the repository at this point in the history
  • Loading branch information
charlespwd committed Oct 9, 2024
1 parent 9a06af0 commit 2ffbef6
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 192 deletions.
5 changes: 5 additions & 0 deletions .changeset/silent-comics-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'theme-check-vscode': major
---

[BREAKING] Remove support for ruby language server
9 changes: 0 additions & 9 deletions packages/vscode-extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,6 @@ This VS Code extensions comes with batteries included.
- `"themeCheck.checkOnChange": boolean`, (default: `true`) makes it so theme check runs on file change.
- `"themeCheck.checkOnSave": boolean`, (default: `true`) makes it so theme check runs on file save.

### Deprecated configuration

If you still want to use the Ruby `theme-check-language-server`, you may use the following deprecated settings:

- `"shopifyLiquid.legacyMode": boolean`, (default: `false`) when true, will use the Ruby `theme-check-language-server`.
- `"shopifyLiquid.languageServerPath": string`, (optional) a path to the `theme-check-language-server` executable. Has higher priority than `shopifyLiquid.shopifyCLIPath`.
- `"shopifyLiquid.shopifyCLIPath": string`, (optional, Unix-only) a path to the `shopify` executable.
- `"themeCheck.onlySingleFileChecks": boolean`, (default: `false`) makes it so theme check only runs single file checks for the files that are open.

## License

MIT.
38 changes: 0 additions & 38 deletions packages/vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,44 +133,6 @@
],
"description": "When true, theme check runs on file save.",
"default": true
},
"shopifyLiquid.legacyMode": {
"order": 40,
"type": [
"boolean"
],
"description": "When true, will use the language server specified by shopifyLiquid.languageServerPath or shopifyLiquid.shopifyCLIPath",
"default": false,
"deprecationMessage": "Deprecated: use only if you want to setup the Ruby theme-check-language-server."
},
"shopifyLiquid.languageServerPath": {
"order": 41,
"type": [
"string",
"null"
],
"default": null,
"description": "Path to theme-check-language-server. Defaults to `which theme-check-language-server` if available on `$PATH`.",
"deprecationMessage": "Deprecated: use only if you want to setup the Ruby theme-check-language-server with `shopifyLiquid.legacyMode` enabled."
},
"shopifyLiquid.shopifyCLIPath": {
"order": 42,
"type": [
"string",
"null"
],
"default": null,
"description": "Path to shopify executable. Defaults to `which shopify` if available on `$PATH`.",
"deprecationMessage": "Deprecated: use only if you want to setup the Ruby theme-check-language-server with `shopifyLiquid.legacyMode` enabled."
},
"themeCheck.onlySingleFileChecks": {
"order": 43,
"type": [
"boolean"
],
"description": "When true, disables whole theme checks. Can improve performance. (theme-check v1.10.0+)",
"default": false,
"deprecationMessage": "Deprecated: only used by the Ruby theme-check-language-server with `shopifyLiquid.legacyMode` enabled"
}
}
},
Expand Down
13 changes: 1 addition & 12 deletions packages/vscode-extension/src/browser/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export async function activate(context: ExtensionContext) {
context.subscriptions.push(
commands.registerCommand('shopifyLiquid.restart', () => restartServer(context)),
);

// context.subscriptions.push(
// commands.registerCommand('shopifyLiquid.runChecks', () => {
// client!.sendRequest('workspace/executeCommand', { command: runChecksCommand });
Expand All @@ -32,8 +33,6 @@ export async function activate(context: ExtensionContext) {
// );
// context.subscriptions.push(formattingProvider);

// workspace.onDidChangeConfiguration(onConfigChange(context));

// // If you change the file, the prettier syntax error is no longer valid
// workspace.onDidChangeTextDocument(({ document }) => {
// const bufferVersionOfDiagnostic = diagnosticTextDocumentVersion.get(document.uri);
Expand Down Expand Up @@ -100,13 +99,3 @@ async function restartServer(context: ExtensionContext) {
}
await startServer(context);
}

const onConfigChange =
(context: ExtensionContext) => (event: { affectsConfiguration: (arg0: string) => any }) => {
const didChangeThemeCheck = event.affectsConfiguration('shopifyLiquid.languageServerPath');
const didChangeShopifyCLI = event.affectsConfiguration('shopifyLiquid.shopifyCLIPath');
const didChangeLegacyMode = event.affectsConfiguration('shopifyLiquid.legacyMode');
if (didChangeThemeCheck || didChangeShopifyCLI || didChangeLegacyMode) {
restartServer(context);
}
};
25 changes: 1 addition & 24 deletions packages/vscode-extension/src/node/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {
TransportKind,
} from 'vscode-languageclient/node';
import LiquidFormatter from '../formatter';
import { getLegacyModeServerOptions } from './legacyMode';
import { getConfig } from '../utils';

const LIQUID: DocumentFilter[] = [
{
Expand All @@ -26,8 +24,7 @@ const sleep = (ms: number) => new Promise((res) => setTimeout(res, ms));
let client: LanguageClient | undefined;

export async function activate(context: ExtensionContext) {
const isRubyLanguageServer = getConfig('shopifyLiquid.legacyMode');
const runChecksCommand = isRubyLanguageServer ? 'runChecks' : 'themeCheck/runChecks';
const runChecksCommand = 'themeCheck/runChecks';

context.subscriptions.push(
commands.registerCommand('shopifyLiquid.restart', () => restartServer(context)),
Expand All @@ -40,10 +37,6 @@ export async function activate(context: ExtensionContext) {

const diagnosticTextDocumentVersion = new Map<Uri, number>();
const diagnosticCollection = languages.createDiagnosticCollection('prettier-plugin-liquid');
if (isRubyLanguageServer) {
// The TS version doesn't need this, we have LiquidHTMLSyntaxError for that.
context.subscriptions.push(diagnosticCollection);
}

// TODO move this to language server (?) Might have issues with prettier import
const formattingProvider = languages.registerDocumentFormattingEditProvider(
Expand All @@ -52,8 +45,6 @@ export async function activate(context: ExtensionContext) {
);
context.subscriptions.push(formattingProvider);

workspace.onDidChangeConfiguration(onConfigChange(context));

// If you change the file, the prettier syntax error is no longer valid
workspace.onDidChangeTextDocument(({ document }) => {
const bufferVersionOfDiagnostic = diagnosticTextDocumentVersion.get(document.uri);
Expand Down Expand Up @@ -121,21 +112,7 @@ async function restartServer(context: ExtensionContext) {
await startServer(context);
}

const onConfigChange =
(context: ExtensionContext) => (event: { affectsConfiguration: (arg0: string) => any }) => {
const didChangeThemeCheck = event.affectsConfiguration('shopifyLiquid.languageServerPath');
const didChangeShopifyCLI = event.affectsConfiguration('shopifyLiquid.shopifyCLIPath');
const didChangeLegacyMode = event.affectsConfiguration('shopifyLiquid.legacyMode');
if (didChangeThemeCheck || didChangeShopifyCLI || didChangeLegacyMode) {
restartServer(context);
}
};

async function getServerOptions(context: ExtensionContext): Promise<ServerOptions | undefined> {
if (getConfig('shopifyLiquid.legacyMode')) {
return getLegacyModeServerOptions();
}

const serverModule = context.asAbsolutePath(path.join('dist', 'node', 'server.js'));
return {
run: {
Expand Down
103 changes: 0 additions & 103 deletions packages/vscode-extension/src/node/legacyMode.ts

This file was deleted.

6 changes: 0 additions & 6 deletions packages/vscode-extension/src/utils.ts

This file was deleted.

0 comments on commit 2ffbef6

Please sign in to comment.