-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove duplicate entries for auto-completion suggestions and sort
- Prefer package local names over global names - Sort local names before global name in textual and diagram editor Fixes #66
- Loading branch information
1 parent
a38f61d
commit e6c6f8f
Showing
6 changed files
with
175 additions
and
46 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
61 changes: 61 additions & 0 deletions
61
extensions/crossmodel-lang/test/language-server/cross-model-completion-provider.test.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,61 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2024 CrossBreeze. | ||
********************************************************************************/ | ||
|
||
import { expandToString } from 'langium/generate'; | ||
import { expectCompletion } from 'langium/test'; | ||
import { address } from './test-utils/test-documents/entity/address.js'; | ||
import { customer } from './test-utils/test-documents/entity/customer.js'; | ||
import { order } from './test-utils/test-documents/entity/order.js'; | ||
import { createCrossModelTestServices, MockFileSystem, parseProject, testUri } from './test-utils/utils.js'; | ||
|
||
const services = createCrossModelTestServices(MockFileSystem); | ||
const assertCompletion = expectCompletion(services); | ||
|
||
describe('CrossModelCompletionProvider', () => { | ||
const text = expandToString` | ||
relationship: | ||
id: Address_Customer | ||
name: "Address - Customer" | ||
parent: <|> | ||
`; | ||
|
||
beforeAll(async () => { | ||
const packageA = await parseProject({ | ||
package: { services, uri: testUri('projectA', 'package.json'), content: { name: 'ProjectA', version: '1.0.0' } }, | ||
documents: [ | ||
{ services, text: address, documentUri: testUri('projectA', 'address.entity.cm') }, | ||
{ services, text: order, documentUri: testUri('projectA', 'order.entity.cm') } | ||
] | ||
}); | ||
|
||
await parseProject({ | ||
package: { | ||
services, | ||
uri: testUri('projectB', 'package.json'), | ||
content: { name: 'ProjectB', version: '1.0.0', dependencies: { ...packageA } } | ||
}, | ||
documents: [{ services, text: customer, documentUri: testUri('projectB', 'customer.entity.cm') }] | ||
}); | ||
}); | ||
|
||
test('Completion for entity references in project A', async () => { | ||
await assertCompletion({ | ||
Check failure on line 43 in extensions/crossmodel-lang/test/language-server/cross-model-completion-provider.test.ts GitHub Actions / build-and-test / windows-2022CrossModelCompletionProvider › Completion for entity references in project A
|
||
text, | ||
parseOptions: { documentUri: testUri('projectA', 'rel.relationship.cm') }, | ||
index: 0, | ||
expectedItems: ['Address', 'Order'], | ||
disposeAfterCheck: true | ||
}); | ||
}); | ||
|
||
test('Completion for entity references in project B', async () => { | ||
await assertCompletion({ | ||
Check failure on line 53 in extensions/crossmodel-lang/test/language-server/cross-model-completion-provider.test.ts GitHub Actions / build-and-test / windows-2022CrossModelCompletionProvider › Completion for entity references in project B
|
||
text, | ||
parseOptions: { documentUri: testUri('projectB', 'rel.relationship.cm') }, | ||
index: 0, | ||
expectedItems: ['Customer', 'ProjectA.Address', 'ProjectA.Order'], | ||
disposeAfterCheck: true | ||
}); | ||
}); | ||
}); |
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