Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce form to edit Relationship data and attributes
Introduce reference resolution and completion mechanism for elements - Ensure we send the global id as part of each identifiable element - Attach reference data to GLSP elements for property view - Replace specific 'requestDiagramNodeEntityModel' method - Replace specific 'findRootReferenceName' method Create Form for Relationship data - Unify form for property view and editor (also for Entity) - Use MUI components consistently and add theming for them - Remove custom stylesheets - Remove dependency to 'react-tabs' as it is no longer used Refactorings: - Rename 'ExternalId' to 'GlobalId' - Ensure IDs do not contain any invalid characters - Fix issue with attribute serialization for relationships
- Loading branch information
1 parent
d6e9ef8
commit 1d83151
Showing
60 changed files
with
1,967 additions
and
1,090 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
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
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
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
35 changes: 35 additions & 0 deletions
35
extensions/crossmodel-lang/src/language-server/cross-model-index-manager.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2024 CrossBreeze. | ||
********************************************************************************/ | ||
import { AstNode, AstNodeDescription, DefaultIndexManager, URI } from 'langium'; | ||
import { CrossModelSharedServices } from './cross-model-module.js'; | ||
import { SemanticRoot, findSemanticRoot } from './util/ast-util.js'; | ||
|
||
export class CrossModelIndexManager extends DefaultIndexManager { | ||
constructor(protected services: CrossModelSharedServices) { | ||
super(services); | ||
} | ||
|
||
getElementById(globalId: string, type?: string): AstNodeDescription | undefined { | ||
return this.allElements().find(desc => desc.name === globalId && (!type || desc.type === type)); | ||
} | ||
|
||
resolveElement(description?: AstNodeDescription): AstNode | undefined { | ||
if (!description) { | ||
return undefined; | ||
} | ||
const document = this.services.workspace.LangiumDocuments.getDocument(description.documentUri); | ||
return document | ||
? this.serviceRegistry.getServices(document.uri).workspace.AstNodeLocator.getAstNode(document.parseResult.value, description.path) | ||
: undefined; | ||
} | ||
|
||
resolveElementById(globalId: string, type?: string): AstNode | undefined { | ||
return this.resolveElement(this.getElementById(globalId, type)); | ||
} | ||
|
||
resolveSemanticElement(uri: URI): SemanticRoot | undefined { | ||
const document = this.services.workspace.LangiumDocuments.getDocument(uri); | ||
return document ? findSemanticRoot(document) : undefined; | ||
} | ||
} |
44 changes: 40 additions & 4 deletions
44
extensions/crossmodel-lang/src/language-server/cross-model-langium-documents.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,51 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2023 CrossBreeze. | ||
********************************************************************************/ | ||
import { DefaultLangiumDocuments } from 'langium'; | ||
import { DefaultLangiumDocuments, DocumentState, LangiumDocument } from 'langium'; | ||
import { TextDocument } from 'vscode-languageserver-textdocument'; | ||
import { URI } from 'vscode-uri'; | ||
import { isPackageUri } from './cross-model-package-manager.js'; | ||
import { CrossModelRoot } from './generated/ast.js'; | ||
import { fixDocument } from './util/ast-util.js'; | ||
import { Utils } from './util/uri-util.js'; | ||
|
||
export class CrossModelLangiumDocuments extends DefaultLangiumDocuments { | ||
override getOrCreateDocument(uri: URI): any { | ||
// only create documents for actual language files but not for package.json | ||
const realUri = isPackageUri(uri) ? undefined : Utils.toRealURIorUndefined(uri); | ||
return realUri ? super.getOrCreateDocument(realUri) : undefined; | ||
const document = this.getDocument(uri); | ||
if (document) { | ||
return document; | ||
} | ||
const documentUri = this.getDocumentUri(uri); | ||
if (documentUri) { | ||
return super.getOrCreateDocument(documentUri); | ||
} | ||
return this.createEmptyDocument(uri); | ||
} | ||
|
||
protected getDocumentUri(uri: URI): URI | undefined { | ||
// we register for package.json files because our package scoping mechanism depends on it | ||
// but we do not want actually want to parse them | ||
if (isPackageUri(uri)) { | ||
return undefined; | ||
} | ||
// we want to resolve existing URIs to properly deal with linked files and folders and not create duplicates for them | ||
return Utils.toRealURIorUndefined(uri); | ||
} | ||
|
||
createEmptyDocument(uri: URI, rootType = CrossModelRoot): LangiumDocument { | ||
const document: LangiumDocument = { | ||
uri, | ||
parseResult: { lexerErrors: [], parserErrors: [], value: { $type: rootType } }, | ||
references: [], | ||
state: DocumentState.Validated, | ||
textDocument: TextDocument.create(uri.toString(), '', 1, ''), | ||
diagnostics: [] | ||
}; | ||
fixDocument(document.parseResult.value, document); | ||
return document; | ||
} | ||
|
||
getDocument(uri: URI): LangiumDocument<CrossModelRoot> | undefined { | ||
return this.documentMap.get(uri.toString()) as LangiumDocument<CrossModelRoot> | undefined; | ||
} | ||
} |
Oops, something went wrong.