Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show SQL cursors in outline view #216

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 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
14 changes: 11 additions & 3 deletions server/src/language/models/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export default class Cache {

/** @type {IncludeStatement[]} */
this.includes = cache.includes || [];

/** @type {Declaration[]} */
this.cursors = cache.cursors || [];

}

/**
Expand All @@ -58,7 +62,8 @@ export default class Cache {
files: [...this.files, ...second.files],
structs: [...this.structs, ...second.structs],
constants: [...this.constants, ...second.constants],
indicators: [...this.indicators, ...second.indicators]
indicators: [...this.indicators, ...second.indicators],
cursor: [...this.cursor, ...second.cursor]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cursor -> cursors

});
} else {
return this;
Expand All @@ -79,6 +84,7 @@ export default class Cache {
...this.subroutines.map(def => def.name),
...this.variables.map(def => def.name),
...this.structs.map(def => def.name),
...this.cursor.map(def => def.name),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cursor -> cursors.

].filter(name => name);
}

Expand All @@ -93,7 +99,8 @@ export default class Cache {
this.structs.filter(d => d.position.path === fsPath).pop(),
this.variables.filter(d => d.position.path === fsPath).pop(),
this.constants.filter(d => d.position.path === fsPath).pop(),
this.files.filter(d => d.position.path === fsPath).pop()
this.files.filter(d => d.position.path === fsPath).pop(),
this.cursor.filter(d => d.position.path === fsPath).pop()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect reference here also. cursor -> cursors

].filter(d => d !== undefined);

const lines = lasts.map(d => d.range && d.range.end ? d.range.end : d.position.line).sort((a, b) => b - a);
Expand All @@ -120,6 +127,7 @@ export default class Cache {
...this.subroutines.filter(def => def.name.toUpperCase() === name),
...this.variables.filter(def => def.name.toUpperCase() === name),
...this.indicators.filter(def => def.name.toUpperCase() === name),
...this.cursor.filter(def => def.name.toUpperCase() === name),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you've updated the cursors property but missed renaming it elsewhere.

];

if (allStructs.length > 0 && possibles.length === 0) {
Expand All @@ -136,7 +144,7 @@ export default class Cache {
}

clearReferences() {
[...this.parameters, ...this.constants, ...this.files, ...this.procedures, ...this.subroutines, ...this.variables, ...this.structs].forEach(def => {
[...this.parameters, ...this.constants, ...this.files, ...this.procedures, ...this.subroutines, ...this.variables, ...this.structs, ...this.cursor].forEach(def => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cursor -> cursors

def.references = [];
});

Expand Down
2 changes: 1 addition & 1 deletion server/src/language/models/declaration.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Cache from "./cache";
export default class Declaration {
/**
*
* @param {"procedure"|"subroutine"|"file"|"struct"|"subitem"|"variable"|"constant"} type
* @param {"procedure"|"subroutine"|"file"|"struct"|"subitem"|"variable"|"constant"|"cursor"} type
*/
constructor(type) {
this.type = type;
Expand Down
Loading