Skip to content

Commit 0272a4a

Browse files
authored
Merge pull request #43 from lstreckeisen/CMI-90-Relationship-arrows-aren-t-included-in-autocomplete
Cmi 90 relationship arrows aren t included in autocomplete
2 parents babd51e + eb6e69e commit 0272a4a

File tree

87 files changed

+1229
-1942
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1229
-1942
lines changed

.eslintrc.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
uses: JetBrains/qodana-action@v2024.3
6262
with:
6363
pr-mode: false
64-
args: --linter,jetbrains/qodana-js:2024.3
64+
args: --baseline,qodana.serif.json,--fail-threshold,2
6565
env:
6666
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_379728607 }}
6767
QODANA_ENDPOINT: 'https://qodana.cloud'

.yarn/install-state.gz

-55.8 KB
Binary file not shown.

eslint.config.mjs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import eslint from '@eslint/js'
2+
import typescriptEslint from 'typescript-eslint';
3+
4+
export default typescriptEslint.config({
5+
ignores: [
6+
'esbuild.mjs',
7+
'eslint.config.mjs',
8+
'**/generated/**'
9+
],
10+
},
11+
eslint.configs.recommended,
12+
typescriptEslint.configs.recommendedTypeChecked,
13+
typescriptEslint.configs.stylisticTypeChecked,
14+
{
15+
languageOptions: {
16+
parserOptions: {
17+
project: ['./tsconfig.json']
18+
}
19+
},
20+
rules: {
21+
'@typescript-eslint/no-unused-vars': [
22+
'error',
23+
{
24+
'argsIgnorePattern': '^_',
25+
'varsIgnorePattern': '^_',
26+
'caughtErrorsIgnorePattern': '^_'
27+
}
28+
]
29+
}
30+
}
31+
);

package.json

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,23 @@
3232
"clean": "rm -rf src/language/generated && rm -rf cml-ls/ && rm -rf dist/"
3333
},
3434
"dependencies": {
35-
"langium": "~3.4.0",
35+
"langium": "~3.5.0",
3636
"vscode-languageserver": "~9.0.1",
3737
"vscode-languageserver-types": "~3.17.5"
3838
},
3939
"devDependencies": {
40-
"@types/node": "^18.0.0",
41-
"@typescript-eslint/eslint-plugin": "~7.3.1",
42-
"@typescript-eslint/parser": "~7.3.1",
40+
"@eslint/js": "^9.26.0",
41+
"@types/node": "^22.15.17",
4342
"@vercel/ncc": "^0.38.3",
44-
"@vitest/coverage-v8": "^3.1.1",
45-
"concurrently": "~8.2.1",
46-
"esbuild": "~0.20.2",
47-
"eslint": "~8.57.0",
48-
"eslint-config-standard": "^17.1.0",
49-
"eslint-plugin-import": "^2.31.0",
50-
"eslint-plugin-n": "^17.17.0",
51-
"eslint-plugin-promise": "^7.2.1",
52-
"langium-cli": "~3.4.0",
53-
"typescript": "~5.1.6",
54-
"vitest": "^3.1.1"
43+
"@vitest/coverage-v8": "^3.1.3",
44+
"concurrently": "~9.1.2",
45+
"esbuild": "~0.25.4",
46+
"eslint": "~9.26.0",
47+
"jiti": "^2.4.2",
48+
"langium-cli": "~3.5.0",
49+
"typescript": "~5.8.3",
50+
"typescript-eslint": "^8.32.0",
51+
"vitest": "^3.1.3"
5552
},
5653
"packageManager": "yarn@4.8.1"
5754
}

src/language/ContextMapperDslModule.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ import { KeywordHoverRegistry } from './hover/KeywordHoverRegistry.js'
2121
import { ContextMapperDslNodeKindProvider } from './shared/ContextMapperDslNodeKindProvider.js'
2222
import { ContextMapperDslFormatter } from './formatting/ContextMapperDslFormatter.js'
2323
import { ContextMapperFormatterRegistry } from './formatting/ContextMapperFormatterRegistry.js'
24+
import { ContextMapperDslCompletionProvider } from './completion/ContextMapperDslCompletionProvider.js'
2425

2526
/**
2627
* Declaration of custom services - add your own service classes here.
2728
*/
28-
export type ContextMapperDslAddedServices = {
29+
export interface ContextMapperDslAddedServices {
2930
validation: {
3031
ContextMapperDslValidator: ContextMapperDslValidator
3132
}
32-
};
33+
}
3334

3435
/**
3536
* Union of Langium default services and your custom services - use this as constructor parameter
@@ -57,7 +58,8 @@ export const ContextMapperDslModule: Module<ContextMapperDslServices, ModuleType
5758
SemanticTokenProvider: (services) => new ContextMapperDslSemanticTokenProvider(services, semanticTokenProviderRegistry),
5859
FoldingRangeProvider: (services) => new ContextMapperDslFoldingRangeProvider(services),
5960
HoverProvider: (services) => new ContextMapperDslHoverProvider(services, new KeywordHoverRegistry()),
60-
Formatter: () => new ContextMapperDslFormatter(new ContextMapperFormatterRegistry())
61+
Formatter: () => new ContextMapperDslFormatter(new ContextMapperFormatterRegistry()),
62+
CompletionProvider: (services) => new ContextMapperDslCompletionProvider(services)
6163
},
6264
references: {
6365
ScopeProvider: (services) => new ContextMapperDslScopeProvider(services),
@@ -102,7 +104,7 @@ export function createContextMapperDslServices (context: DefaultSharedModuleCont
102104
if (!context.connection) {
103105
// We don't run inside a language server
104106
// Therefore, initialize the configuration provider instantly
105-
shared.workspace.ConfigurationProvider.initialized({})
107+
void shared.workspace.ConfigurationProvider.initialized({})
106108
}
107109
return { shared, ContextMapperDsl }
108110
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { CompletionContext, DefaultCompletionProvider } from 'langium/lsp'
2+
import { GrammarAST } from 'langium'
3+
4+
export class ContextMapperDslCompletionProvider extends DefaultCompletionProvider {
5+
/*
6+
Langium hides non-alphabetical keywords by default. (see https://github.com/eclipse-langium/langium/pull/697)
7+
This causes relationship arrows like '<->' to not be suggested in autocomplete.
8+
Overriding this function allows all keywords to be suggested.
9+
*/
10+
protected override filterKeyword (_context: CompletionContext, _keyword: GrammarAST.Keyword): boolean {
11+
return true
12+
}
13+
}

src/language/hover/ContextMapperDslHoverProvider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { KeywordHoverRegistry } from './KeywordHoverRegistry.js'
66

77
export class ContextMapperDslHoverProvider extends MultilineCommentHoverProvider {
88
private readonly _keywordHoverRegistry: KeywordHoverRegistry
9+
910
constructor (services: LangiumServices, keywordHoverRegistry: KeywordHoverRegistry) {
1011
super(services)
1112
this._keywordHoverRegistry = keywordHoverRegistry

src/language/hover/KeywordHoverRegistry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export class KeywordHoverRegistry {
2-
private readonly _registry: Map<string, string> = new Map([
2+
private readonly _registry = new Map<string, string>([
33
[
44
'BoundedContext',
55
`**Bounded Context**: A description of a boundary (typically a subsystem, or the work of a particular team) within which a particular model is defined and applicable. \

src/language/main.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import { createContextMapperDslServices } from './ContextMapperDslModule.js'
77
const connection = createConnection(ProposedFeatures.all)
88

99
// Inject the shared services and language-specific services
10-
const { shared } = createContextMapperDslServices({ connection, ...NodeFileSystem })
10+
const { shared } = createContextMapperDslServices({
11+
connection,
12+
...NodeFileSystem
13+
})
1114

1215
// Start the language server with the shared services
1316
startLanguageServer(shared)

0 commit comments

Comments
 (0)