Skip to content

Commit

Permalink
build(deps-dev): bump langium and langium-cli (#942)
Browse files Browse the repository at this point in the history
Bumps
[langium-cli](https://github.com/eclipse-langium/langium/tree/HEAD/packages/langium-cli)
from 3.0.0-next.e78aeba to 3.0.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/eclipse-langium/langium/releases">langium-cli's
releases</a>.</em></p>
<blockquote>
<h2>v3.0.0</h2>
<p>Changes: <a
href="https://github.com/eclipse-langium/langium/blob/main/packages/langium/CHANGELOG.md#v300-feb-2024">https://github.com/eclipse-langium/langium/blob/main/packages/langium/CHANGELOG.md#v300-feb-2024</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/eclipse-langium/langium/blob/main/packages/langium-cli/CHANGELOG.md">langium-cli's
changelog</a>.</em></p>
<blockquote>
<h2>v3.0.1 (Feb. 2024)</h2>
<p>Fixed a minor issue related to generated code for projects that don't
use the <code>langium/lsp</code> import (<a
href="https://redirect.github.com/eclipse-langium/langium/pull/1393">#1393</a>).</p>
<h2>v3.0.0 (Feb. 2024)</h2>
<p>Some adjustments of the generated code due to the LSP bundling
changes in Langium. For further information, see <a
href="https://github.com/eclipse-langium/langium/blob/main/packages/langium/CHANGELOG.md#smaller-bundles-with-exports">here</a>.</p>
<h2>v2.0.1 (Aug. 2023)</h2>
<p>Fix a bug that prevented usage of the JS API of the CLI package (<a
href="https://redirect.github.com/eclipse-langium/langium/pull/1160">#1160</a>).</p>
<h2>v2.0.0 (Aug. 2023)</h2>
<h3>EcmaScript Modules (ESM)</h3>
<p>This package is now compiling to ESM only, refer to <a
href="https://github.com/eclipse-langium/langium/blob/main/packages/langium/CHANGELOG.md#ecmascript-modules-esm">this
changelog entry</a></p>
<h3>Breaking Changes</h3>
<ul>
<li>The CLI now always uses the original <code>projectName</code> of the
<code>langium-config.json</code> property for the generated type/object
names. It no longer performs kebab-case transformation (<a
href="https://redirect.github.com/eclipse-langium/langium/pull/1122">#1122</a>).</li>
<li>We've decided to remove generated <code>$container</code> type
declarations for types where it isn't clear what the container types can
be (<a
href="https://redirect.github.com/eclipse-langium/langium/pull/1055">#1055</a>).</li>
</ul>
<h2>v1.3.0 (Aug. 2023)</h2>
<h3>Railroad Syntax Diagrams</h3>
<p>With the introduction of <a
href="https://github.com/eclipse-langium/langium/tree/main/packages/langium-railroad"><code>langium-railroad</code></a>,
the CLI is now capable of generating railroad syntax diagrams for your
language (<a
href="https://redirect.github.com/eclipse-langium/langium/pull/1075">#1075</a>).
To generate them to a file, use the following example config:</p>
<pre lang="json"><code>{
    ...
    &quot;languages&quot;: [{
        ...
        &quot;railroad&quot;: {
            &quot;out&quot;: &quot;docs/syntax-diagram.html&quot;
        }
    }],
    ...
}
</code></pre>
<blockquote>
<p><strong>Note</strong>
The vscode extension for Langium contributes the <code>Show Railroad
Syntax Diagram</code> command to show this HTML in a webview.</p>
</blockquote>
<h3>Generated Terminal Definitions</h3>
<p>The generated <code>ast.ts</code> file will now also contain an
object containing all regular expressions used by your grammar's
terminal rules (<a
href="https://redirect.github.com/eclipse-langium/langium/pull/1097">#1097</a>).
This allows to more easily reuse those regular expressions in your
code.</p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/eclipse-langium/langium/commits/HEAD/packages/langium-cli">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=langium-cli&package-manager=npm_and_yarn&previous-version=3.0.0-next.e78aeba&new-version=3.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

---------

Co-authored-by: Lars Reimann <mail@larsreimann.com>
  • Loading branch information
dependabot[bot] and lars-reimann authored Mar 1, 2024
1 parent 270cf7c commit c25d147
Show file tree
Hide file tree
Showing 61 changed files with 140 additions and 161 deletions.
30 changes: 15 additions & 15 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion packages/safe-ds-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"chalk": "^5.3.0",
"commander": "^12.0.0",
"glob": "^10.3.10",
"langium": "^3.0.0-next.e78aeba",
"langium": "^3.0.0",
"true-myth": "^7.1.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/safe-ds-cli/src/cli/check.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createSafeDsServicesWithBuiltins } from '@safe-ds/lang';
import { createSafeDsServices } from '@safe-ds/lang';
import { NodeFileSystem } from 'langium/node';
import { extractDocuments } from '../helpers/documents.js';
import { diagnosticToString, getDiagnostics } from '../helpers/diagnostics.js';
Expand All @@ -7,7 +7,7 @@ import chalk from 'chalk';
import { ExitCode } from './exitCode.js';

export const check = async (fsPaths: string[], options: CheckOptions): Promise<void> => {
const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs;
const services = (await createSafeDsServices(NodeFileSystem)).SafeDs;

let errorCount = 0;

Expand Down
4 changes: 2 additions & 2 deletions packages/safe-ds-cli/src/cli/format.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createSafeDsServicesWithBuiltins } from '@safe-ds/lang';
import { createSafeDsServices } from '@safe-ds/lang';
import { NodeFileSystem } from 'langium/node';
import { extractDocuments } from '../helpers/documents.js';
import { exitIfDocumentHasSyntaxErrors } from '../helpers/diagnostics.js';
Expand All @@ -7,7 +7,7 @@ import { writeFile } from 'node:fs/promises';
import chalk from 'chalk';

export const format = async (fsPaths: string[]): Promise<void> => {
const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs;
const services = (await createSafeDsServices(NodeFileSystem)).SafeDs;
const documents = await extractDocuments(services, fsPaths);

// Exit if any document has syntax errors before formatting code
Expand Down
4 changes: 2 additions & 2 deletions packages/safe-ds-cli/src/cli/generate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createSafeDsServicesWithBuiltins } from '@safe-ds/lang';
import { createSafeDsServices } from '@safe-ds/lang';
import chalk from 'chalk';
import { URI } from 'langium';
import { NodeFileSystem } from 'langium/node';
Expand All @@ -9,7 +9,7 @@ import { makeParentDirectoriesSync } from '../helpers/files.js';
import { exitIfDocumentHasErrors } from '../helpers/diagnostics.js';

export const generate = async (fsPaths: string[], options: GenerateOptions): Promise<void> => {
const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs;
const services = (await createSafeDsServices(NodeFileSystem)).SafeDs;
const documents = await extractDocuments(services, fsPaths);

// Exit if any document has errors before generating code
Expand Down
4 changes: 2 additions & 2 deletions packages/safe-ds-cli/tests/helpers/documents.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { describe, expect, it } from 'vitest';
import { Result } from 'true-myth';
import { processPaths } from '../../src/helpers/documents.js';
import { createSafeDsServicesWithBuiltins } from '@safe-ds/lang';
import { createSafeDsServices } from '@safe-ds/lang';
import { NodeFileSystem } from 'langium/node';
import { fileURLToPath } from 'url';
import path from 'node:path';
import { ExitCode } from '../../src/cli/exitCode.js';

describe('processPaths', async () => {
const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs;
const services = (await createSafeDsServices(NodeFileSystem)).SafeDs;
const testResourcesRoot = new URL('../resources/processPaths/', import.meta.url);

const tests: ProcessPathsTest[] = [
Expand Down
4 changes: 2 additions & 2 deletions packages/safe-ds-lang/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"dependencies": {
"chevrotain": "^11.0.3",
"glob": "^10.3.10",
"langium": "^3.0.0-next.e78aeba",
"langium": "^3.0.0",
"semver": "^7.6.0",
"source-map": "^0.7.4",
"tree-kill": "^1.2.2",
Expand All @@ -56,7 +56,7 @@
"devDependencies": {
"@types/node": "^18.18.12",
"@types/ws": "^8.5.10",
"langium-cli": "^3.0.0-next.e78aeba",
"langium-cli": "^3.0.1",
"true-myth": "^7.1.0"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/safe-ds-lang/src/language/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Services
export type { SafeDsServices } from './safe-ds-module.js';
export { createSafeDsServices, createSafeDsServicesWithBuiltins } from './safe-ds-module.js';
export { createSafeDsServices } from './safe-ds-module.js';

// Language Server
export { startLanguageServer } from './main.js';
Expand Down
56 changes: 24 additions & 32 deletions packages/safe-ds-lang/src/language/safe-ds-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,46 +186,33 @@ export const SafeDsSharedModule: Module<SafeDsSharedServices, DeepPartial<SafeDs
* @param options Further options to configure the Safe-DS module.
* @return An object wrapping the shared services and the language-specific services.
*/
export const createSafeDsServices = function (
export const createSafeDsServices = async function (
context: DefaultSharedModuleContext,
options?: ModuleOptions,
): {
): Promise<{
shared: LangiumSharedServices;
SafeDs: SafeDsServices;
} {
}> {
const shared = inject(createDefaultSharedModule(context), SafeDsGeneratedSharedModule, SafeDsSharedModule);
const SafeDs = inject(createDefaultModule({ shared }), SafeDsGeneratedModule, SafeDsModule);

shared.ServiceRegistry.register(SafeDs);
registerValidationChecks(SafeDs);
SafeDs.runtime.Runner.updateRunnerCommand(options?.runnerCommand);
return { shared, SafeDs };
};

/**
* Create the full set of services required by Langium and load all builtin files into the workspace.
*
* First inject the shared services by merging two modules:
* - Langium default shared services
* - Services generated by langium-cli
*
* Then inject the language-specific services by merging three modules:
* - Langium default language-specific services
* - Services generated by langium-cli
* - Services specified in this file
*
* @param context Optional module context with the LSP connection.
* @param options Further options to configure the Safe-DS module.
* @return An object wrapping the shared services and the language-specific services.
*/
export const createSafeDsServicesWithBuiltins = async function (
context: DefaultSharedModuleContext,
options?: ModuleOptions,
): Promise<{
shared: LangiumSharedServices;
SafeDs: SafeDsServices;
}> {
const { shared, SafeDs } = createSafeDsServices(context, options);
await shared.workspace.WorkspaceManager.initializeWorkspace([]);
// If we don't run inside a language server, initialize the configuration provider instantly
if (!context.connection) {
await shared.workspace.ConfigurationProvider.initialized({});
}

// Apply options
if (!options?.omitBuiltins) {
await shared.workspace.WorkspaceManager.initializeWorkspace([]);
}
if (options?.runnerCommand) {
/* c8 ignore next 2 */
SafeDs.runtime.Runner.updateRunnerCommand(options?.runnerCommand);
}

return { shared, SafeDs };
};

Expand All @@ -234,7 +221,12 @@ export const createSafeDsServicesWithBuiltins = async function (
*/
export interface ModuleOptions {
/**
* Optional command to start the runner, if available.
* By default, builtins are loaded into the workspace. If this option is set to true, builtins are omitted.
*/
omitBuiltins?: boolean;

/**
* Command to start the runner.
*/
runnerCommand?: string;
}
12 changes: 6 additions & 6 deletions packages/safe-ds-lang/tests/helpers/nodeFinder.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { afterEach, describe, expect, it } from 'vitest';
import { getNodeOfType, getNodeByLocation } from './nodeFinder.js';
import { createSafeDsServices } from '../../src/language/safe-ds-module.js';
import { getNodeByLocation, getNodeOfType } from './nodeFinder.js';
import { createSafeDsServices } from '../../src/language/index.js';
import { EmptyFileSystem } from 'langium';
import { AssertionError } from 'assert';
import { clearDocuments, parseHelper } from 'langium/test';
import { isSdsClass, isSdsDeclaration, isSdsEnum } from '../../src/language/generated/ast.js';

describe('getNodeByLocation', () => {
const services = createSafeDsServices(EmptyFileSystem).SafeDs;
describe('getNodeByLocation', async () => {
const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs;

afterEach(async () => {
await clearDocuments(services);
Expand Down Expand Up @@ -56,8 +56,8 @@ describe('getNodeByLocation', () => {
});
});

describe('getNodeOfType', () => {
const services = createSafeDsServices(EmptyFileSystem).SafeDs;
describe('getNodeOfType', async () => {
const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs;

afterEach(async () => {
await clearDocuments(services);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { CODE_EXPERIMENTAL_LANGUAGE_FEATURE } from '../../../src/language/valida
import { locationToString } from '../../../src/helpers/locations.js';
import { loadDocuments } from '../../helpers/testResources.js';

const services = createSafeDsServices(NodeFileSystem).SafeDs;
const services = (await createSafeDsServices(NodeFileSystem)).SafeDs;
const langiumDocuments = services.shared.workspace.LangiumDocuments;
const builtinFiles = listBuiltinFiles();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import { createSafeDsServices } from '../../../src/language/index.js';
import { getNodeOfType } from '../../helpers/nodeFinder.js';

const services = createSafeDsServices(EmptyFileSystem).SafeDs;
const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs;
const commentProvider = services.documentation.CommentProvider;
const testComment = '/* test */';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { createSafeDsServices } from '../../../src/language/index.js';
import { getNodeOfType } from '../../helpers/nodeFinder.js';
import { expandToString } from 'langium/generate';

const services = createSafeDsServices(EmptyFileSystem).SafeDs;
const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs;
const documentationProvider = services.documentation.DocumentationProvider;
const testDocumentation = 'Lorem ipsum.';

Expand Down
2 changes: 1 addition & 1 deletion packages/safe-ds-lang/tests/language/flow/creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import fs from 'fs';
import { getSyntaxErrors, SyntaxErrorsInCodeError } from '../../helpers/diagnostics.js';
import { findTestChecks } from '../../helpers/testChecks.js';

const services = createSafeDsServices(EmptyFileSystem).SafeDs;
const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs;
const rootResourceName = 'call graph';

export const createCallGraphTests = (): Promise<CallGraphTest[]> => {
Expand Down
2 changes: 1 addition & 1 deletion packages/safe-ds-lang/tests/language/flow/model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createSafeDsServices } from '../../../src/language/index.js';
import { EmptyFileSystem } from 'langium';
import { isSdsModule, SdsCallable } from '../../../src/language/generated/ast.js';

const services = createSafeDsServices(EmptyFileSystem).SafeDs;
const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs;
const code = `
fun f1()
fun f2()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import {
SdsCall,
SdsCallable,
} from '../../../src/language/generated/ast.js';
import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js';
import { createSafeDsServices } from '../../../src/language/index.js';
import { createCallGraphTests } from './creator.js';
import { getNodeOfType } from '../../helpers/nodeFinder.js';
import { isRangeEqual } from 'langium/test';
import { locationToString } from '../../../src/helpers/locations.js';
import { AssertionError } from 'assert';
import { NodeFileSystem } from 'langium/node';

const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs;
const services = (await createSafeDsServices(NodeFileSystem)).SafeDs;
const callGraphComputer = services.flow.CallGraphComputer;

describe('SafeDsCallGraphComputer', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/safe-ds-lang/tests/language/generation/creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import {
uriToShortenedTestResourceName,
} from '../../helpers/testResources.js';
import path from 'path';
import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js';
import { ErrorsInCodeError, getErrorsAtURI } from '../../helpers/diagnostics.js';
import { findTestChecks } from '../../helpers/testChecks.js';
import { Location } from 'vscode-languageserver';
import { NodeFileSystem } from 'langium/node';
import { TestDescription, TestDescriptionError } from '../../helpers/testDescription.js';
import { locationToString } from '../../../src/helpers/locations.js';
import { URI } from 'langium';
import { createSafeDsServices } from '../../../src/language/index.js';

const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs;
const services = (await createSafeDsServices(NodeFileSystem)).SafeDs;
const langiumDocuments = services.shared.workspace.LangiumDocuments;

const rootResourceName = 'generation';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { createSafeDsServicesWithBuiltins } from '../../../src/language/index.js';
import { describe, expect, it } from 'vitest';
import { NodeFileSystem } from 'langium/node';
import { createGenerationTests } from './creator.js';
import { loadDocuments } from '../../helpers/testResources.js';
import { stream, URI } from 'langium';
import { createSafeDsServices } from '../../../src/language/index.js';

const services = (await createSafeDsServicesWithBuiltins(NodeFileSystem)).SafeDs;
const services = (await createSafeDsServices(NodeFileSystem)).SafeDs;
const langiumDocuments = services.shared.workspace.LangiumDocuments;
const pythonGenerator = services.generation.PythonGenerator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { NodeFileSystem } from 'langium/node';
import { createGrammarTests } from './creator.js';
import { getSyntaxErrors } from '../../helpers/diagnostics.js';

const services = createSafeDsServices(NodeFileSystem).SafeDs;
const services = (await createSafeDsServices(NodeFileSystem)).SafeDs;

describe('grammar', () => {
it.each(createGrammarTests())('$testName', async (test) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '../../../src/language/generated/ast.js';
import { escapeString } from '../../../src/language/grammar/safe-ds-value-converter.js';

const services = createSafeDsServices(EmptyFileSystem).SafeDs;
const services = (await createSafeDsServices(EmptyFileSystem, { omitBuiltins: true })).SafeDs;

describe('runConverter', () => {
describe('ID', () => {
Expand Down
Loading

0 comments on commit c25d147

Please sign in to comment.