Skip to content

Commit

Permalink
move profiles and tools in separated directories
Browse files Browse the repository at this point in the history
  • Loading branch information
ydaveluy committed Aug 17, 2024
1 parent d7b8cd3 commit 73ad8ff
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 14 deletions.
15 changes: 7 additions & 8 deletions src/language/lsp/document-update-handler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { TextDocument } from 'langium';
import { URI } from 'langium';
import { URI, TextDocument } from 'langium';
import { DefaultDocumentUpdateHandler } from 'langium/lsp';
import type { TextDocumentChangeEvent } from 'vscode-languageserver';
import type { XsmpSharedServices } from '../xsmp-module.js';
Expand All @@ -21,12 +20,12 @@ export class XsmpDocumentUpdateHandler extends DefaultDocumentUpdateHandler {
if (this.serviceRegistry.hasServices(uri)) {
// Only fire the document generation when the workspace manager is ready
// Otherwise, we might miss the initial indexing of the workspace
this.workspaceManager.ready.then(() => {
this.workspaceLock.write(token => this.documentGenerator.generate(uri, token));
}).catch(err => {
// This should never happen, but if it does, we want to know about it
console.error('Workspace initialization failed. Could not perform document generation.', err);
});

this.workspaceManager.ready.then(() => this.workspaceLock.read(() => this.documentGenerator.generate(uri)))
.catch(err => {
// This should never happen, but if it does, we want to know about it
console.error('Workspace initialization failed. Could not perform document generation.', err);
});

}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GapPatternCppGenerator } from './gap-pattern-generator.js';
import { GapPatternCppGenerator } from '../../generator/cpp/gap-pattern-generator.js';
import type { XsmpSharedServices } from '../../xsmp-module.js';
import { CxxStandard } from './generator.js';
import { CxxStandard } from '../../generator/cpp/generator.js';
import type * as ast from '../../generated/ast.js';

import { expandToString as s } from 'langium/generate';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { AstUtils, UriUtils } from 'langium';
import * as fs from 'fs';
import * as Solver from '../../utils/solver.js';
import { Duration, Instant } from '@js-joda/core';
import type { TaskAcceptor, XsmpGenerator } from '../generator.js';
import type { TaskAcceptor, XsmpGenerator } from '../../generator/generator.js';
import { create } from 'xmlbuilder2';

export class SmpGenerator implements XsmpGenerator {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/language/workspace/document-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import type { Cancellation, DocumentBuilder, IndexManager, LangiumDocument, Lang
import * as ast from '../generated/ast.js';
import { findProjectContainingUri } from '../utils/project-utils.js';
import { DiagnosticSeverity } from 'vscode-languageserver';
import { SmpGenerator } from '../generator/smp/generator.js';
import { SmpGenerator } from '../tools/smp/generator.js';
import pLimit from 'p-limit';
import type { Task, TaskAcceptor } from '../generator/generator.js';
import { XsmpSdkGenerator } from '../generator/cpp/xsmp-sdk-generator.js';
import { XsmpSdkGenerator } from '../profiles/xsmp-sdk/generator.js';
import type { XsmpSharedServices } from '../xsmp-module.js';

const limit = pLimit(8);
Expand All @@ -32,7 +32,7 @@ export class XsmpDocumentGenerator {
return document.state === DocumentState.Validated && document.parseResult.parserErrors.length === 0 && !document.diagnostics?.some(d => d.severity === DiagnosticSeverity.Error);
}

async generate(uri: URI, _cancelToken: Cancellation.CancellationToken): Promise<void> {
async generate(uri: URI, _cancelToken?: Cancellation.CancellationToken): Promise<void> {
const document = this.langiumDocuments.getDocument(uri);
if (!document || !this.isValid(document)) {
return;
Expand Down

0 comments on commit 73ad8ff

Please sign in to comment.