Skip to content

Commit

Permalink
Fix commonjs package
Browse files Browse the repository at this point in the history
  • Loading branch information
Lotes committed Mar 11, 2024
1 parent 1b0bd2a commit 5c794c3
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 32 deletions.
6 changes: 3 additions & 3 deletions packages/langium-sql-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
"src"
],
"type": "commonjs",
"exports": "./dist/node/extension.js",
"exports": "./dist/node/extension.cjs",
"types": "./dist/node/extension.d.ts",
"main": "./dist/node/extension.js",
"browser": "./dist/browser/extension.js",
"main": "./dist/node/extension.cjs",
"browser": "./dist/browser/extension.cjs",
"scripts": {
"vscode:prepublish": "npm run build && npm run lint",
"build": "node esbuild.mjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/langium-sql-vscode/src/browser/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as vscode from "vscode";
import {
LanguageClient,
LanguageClientOptions
} from "vscode-languageclient/browser";
} from "vscode-languageclient/browser.js";

let client: LanguageClient;

Expand Down
22 changes: 11 additions & 11 deletions packages/langium-sql-vscode/src/browser/language-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
* terms of the MIT License, which is available in the project root.
******************************************************************************/

import { EmptyFileSystem } from 'langium';
import { startLanguageServer } from 'langium/lsp';
import { createConnection, BrowserMessageReader, BrowserMessageWriter } from 'vscode-languageserver/browser.js';
import { createSqlServices } from 'langium-sql';

/* browser specific setup code */
const messageReader = new BrowserMessageReader(self);
const messageWriter = new BrowserMessageWriter(self);
Promise.all([import('langium'), import('langium/lsp'), import('langium-sql')] as const)
.then(([{EmptyFileSystem}, {startLanguageServer}, {createSqlServices}]) => {
/* browser specific setup code */
const messageReader = new BrowserMessageReader(self);
const messageWriter = new BrowserMessageWriter(self);

const connection = createConnection(messageReader, messageWriter);
const connection = createConnection(messageReader, messageWriter);

// Inject the shared services and language-specific services
const { shared } = createSqlServices({ connection, ...EmptyFileSystem });
// Inject the shared services and language-specific services
const { shared } = createSqlServices({ connection, ...EmptyFileSystem });

// Start the language server with the shared services
startLanguageServer(shared);
// Start the language server with the shared services
startLanguageServer(shared);
});
2 changes: 1 addition & 1 deletion packages/langium-sql-vscode/src/node/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
LanguageClientOptions,
ServerOptions,
TransportKind,
} from "vscode-languageclient/node";
} from "vscode-languageclient/node.js";

let client: LanguageClient;

Expand Down
34 changes: 18 additions & 16 deletions packages/langium-sql-vscode/src/node/language-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,24 @@
* terms of the MIT License, which is available in the project root.
******************************************************************************/

import { startLanguageServer } from "langium";
import { NodeFileSystem } from "langium/node";
import { createConnection, ProposedFeatures } from "vscode-languageserver/node";
import { createSqlServices } from "langium-sql";
//import { DialectTypes } from "langium-sql/lib/sql-data-types";
//import { MySqlDialectTypes } from "langium-sql/lib/dialects/mysql/data-types";
import { createConnection, ProposedFeatures } from "vscode-languageserver/node.js";

// Create a connection to the client
const connection = createConnection(ProposedFeatures.all);
Promise.all([import('langium/node'), import('langium/lsp'), import('langium-sql')] as const)
.then(([{NodeFileSystem}, {startLanguageServer}, {createSqlServices}]) => {
//import { DialectTypes } from "langium-sql/lib/sql-data-types";
//import { MySqlDialectTypes } from "langium-sql/lib/dialects/mysql/data-types";

// Inject the shared services and language-specific services
const { shared } = createSqlServices({
...NodeFileSystem,
connection,
//module: {dialect: {dataTypes: () => new DialectTypes(MySqlDialectTypes)}}
});
// Create a connection to the client
const connection = createConnection(ProposedFeatures.all);

// Inject the shared services and language-specific services
const { shared } = createSqlServices({
...NodeFileSystem,
connection,
//module: {dialect: {dataTypes: () => new DialectTypes(MySqlDialectTypes)}}
});

// Start the language server with the shared services
startLanguageServer(shared);
});

// Start the language server with the shared services
startLanguageServer(shared);

0 comments on commit 5c794c3

Please sign in to comment.