Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hugo/content/docs/learn/workflow/resolve_cross_references.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ The _index manager_ is keeping in mind the global symbols of your language. It c

```ts
export interface ScopeComputation {
computeExports(document: LangiumDocument, cancelToken?: CancellationToken): Promise<AstNodeDescription[]>;
computeLocalScopes(document: LangiumDocument, cancelToken?: CancellationToken): Promise<PrecomputedScopes>;
collectExportedSymbols(document: LangiumDocument, cancelToken?: CancellationToken): Promise<AstNodeDescription[]>;
collectLocalSymbols(document: LangiumDocument, cancelToken?: CancellationToken): Promise<LocalSymbols>;
}
```

Expand Down
6 changes: 3 additions & 3 deletions hugo/content/docs/recipes/scoping/file-based.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ npm run langium:generate

## Step 2: Exporting persons to the global scope

The index manager shall get all persons that are marked with the export keyword. In Langium this is done by overriding the `ScopeComputation.getExports(…)` function. Here is the implementation:
The index manager shall get all persons that are marked with the export keyword. In Langium this is done by overriding the `ScopeComputation.collectExportedSymbols(…)` function. Here is the implementation:

```typescript
export class HelloWorldScopeComputation extends DefaultScopeComputation {
override async computeExports(document: LangiumDocument<AstNode>): Promise<AstNodeDescription[]> {
override async collectExportedSymbols(document: LangiumDocument<AstNode>): Promise<AstNodeDescription[]> {
const model = document.parseResult.value as Model;
return model.persons
.filter(p => p.published)
Expand Down Expand Up @@ -217,7 +217,7 @@ import { HelloWorldAstType, Model, Person } from "./generated/ast.js";
import { dirname, join } from "node:path";

export class HelloWorldScopeComputation extends DefaultScopeComputation {
override async computeExports(document: LangiumDocument<AstNode>): Promise<AstNodeDescription[]> {
override async collectExportedSymbols(document: LangiumDocument<AstNode>): Promise<AstNodeDescription[]> {
const model = document.parseResult.value as Model;
return model.persons
.filter(p => p.published)
Expand Down
10 changes: 5 additions & 5 deletions hugo/content/docs/recipes/scoping/qualified-name.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const CppModule: Module<CppServices, PartialLangiumServices & CppAddedSer
}
```

Next, we can start implementing our custom scoping by overriding the `computeExports` function. This function is particularly important, as it allows us to change export nodes of our model using qualified names: We'll also want to annotate this function with `override`, since there's already a default definition provided.
Next, we can start implementing our custom scoping by overriding the `collectExportedSymbols` function. This function is particularly important, as it allows us to change export nodes of our model using qualified names: We'll also want to annotate this function with `override`, since there's already a default definition provided.

```ts
export class CppScopeComputation extends DefaultScopeComputation {
Expand All @@ -59,7 +59,7 @@ export class CppScopeComputation extends DefaultScopeComputation {
/**
* Export all functions using their fully qualified name
*/
override async computeExports(document: LangiumDocument): Promise<AstNodeDescription[]> {
override async collectExportedSymbols(document: LangiumDocument): Promise<AstNodeDescription[]> {
const exportedDescriptions: AstNodeDescription[] = [];
for (const childNode of streamAllContents(document.parseResult.value)) {
if (isFunctionDeclaration(childNode)) {
Expand Down Expand Up @@ -108,7 +108,7 @@ export class CppScopeComputation extends DefaultScopeComputation {

// Emitting previous implementation for brevity

override async computeLocalScopes(document: LangiumDocument): Promise<PrecomputedScopes> {
override async collectLocalSymbols(document: LangiumDocument): Promise<LocalSymbols> {
const model = document.parseResult.value as CppProgram;
// This map stores a list of descriptions for each node in our document
const scopes = new MultiMap<AstNode, AstNodeDescription>();
Expand Down Expand Up @@ -166,7 +166,7 @@ export class CppScopeComputation extends DefaultScopeComputation {
/**
* Export all functions using their fully qualified name
*/
override async computeExports(document: LangiumDocument): Promise<AstNodeDescription[]> {
override async collectExportedSymbols(document: LangiumDocument): Promise<AstNodeDescription[]> {
const exportedDescriptions: AstNodeDescription[] = [];
for (const childNode of streamAllContents(document.parseResult.value)) {
if (isFunctionDeclaration(childNode)) {
Expand All @@ -179,7 +179,7 @@ export class CppScopeComputation extends DefaultScopeComputation {
return exportedDescriptions;
}

override async computeLocalScopes(document: LangiumDocument): Promise<PrecomputedScopes> {
override async collectLocalSymbols(document: LangiumDocument): Promise<LocalSymbols> {
const model = document.parseResult.value as CppProgram;
// This multi-map stores a list of descriptions for each node in our document
const scopes = new MultiMap<AstNode, AstNodeDescription>();
Expand Down