Skip to content

Commit

Permalink
Resolved merge conflicts and fixed type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
vinzbarbuto committed Jul 17, 2024
1 parent d18dad3 commit 9a74383
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,14 @@
"id": "lf-lang-library",
"name": "Lingo Libraries"
}
],
"commandPalette": [
]
},
"commandPalette": [
{
"command": "linguafranca.getVersion",
"when": "false"
}
]
}
},
"devDependencies": {
"@types/chai": "^4.3.1",
Expand Down
2 changes: 1 addition & 1 deletion src/extension_version.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
'use strict';
// This is a generated file. Do not edit.
export const version = "85d09cd0ed28b3b85528b8a1ae6dfc5438cae07d";
export const version = "df4ce25f16c01173e9d4c0ce64a3b2299b52505d";
36 changes: 18 additions & 18 deletions src/lfview/lf-data-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ export class LFDataProvider implements vscode.TreeDataProvider<LFDataProviderNod
let node = new LFDataProviderNode(dataNode.label, dataNode.uri, LFDataProviderNodeRole.FILE, this.type, []);
root.children!.push(node);
if (dataNode.children.length > 0) {
dataNode.children.forEach(child => {
node.children.push(new LFDataProviderNode(child.label,
dataNode.children.forEach((child: any) => {
node.children!.push(new LFDataProviderNode(child.label,
child.uri,
LFDataProviderNodeRole.REACTOR,
this.type, [],
Expand All @@ -292,17 +292,17 @@ export class LFDataProvider implements vscode.TreeDataProvider<LFDataProviderNod
const library_root = this.buildLibraryRoot(dataNode.uri, root);
let node = new LFDataProviderNode(dataNode.label, dataNode.uri, LFDataProviderNodeRole.FILE, this.type, []);
if (dataNode.children.length > 0) {
dataNode.children.forEach(child => {
node.children.push(new LFDataProviderNode(child.label,
dataNode.children.forEach((child: any) => {
node.children!.push(new LFDataProviderNode(child.label,
child.uri,
LFDataProviderNodeRole.REACTOR,
this.type, [],
child.position
));
});
}
if (library_root.children.find(n => n.label === node.label) === undefined) {
library_root.children.push(node);
if (library_root.children!.find(n => n.label === node.label) === undefined) {
library_root.children!.push(node);
}
this.sortData();
}
Expand All @@ -327,13 +327,13 @@ export class LFDataProvider implements vscode.TreeDataProvider<LFDataProviderNod
* @param node - The node whose children need to be sorted.
*/
sortNodes(node: LFDataProviderNode) {
if (node.children.length > 0) {
node.children.sort((a, b) => {
if (node.children!.length > 0) {
node.children!.sort((a, b) => {
const labelA = typeof a.label === 'string' ? a.label : a.uri.fsPath.split('/').pop() || '';
const labelB = typeof b.label === 'string' ? b.label : b.uri.fsPath.split('/').pop() || '';
return labelA.localeCompare(labelB);
});
node.children.forEach(n => this.sortNodes(n));
node.children!.forEach(n => this.sortNodes(n));
}
}

Expand Down Expand Up @@ -366,11 +366,11 @@ export class LFDataProvider implements vscode.TreeDataProvider<LFDataProviderNod
const splittedUri = uri.split('/');
const projectLabel = splittedUri[splittedUri.length - this.path_offset + 3];

const existingLibraryRoot = root.children.find(item => item.label === projectLabel);
const existingLibraryRoot = root.children!.find(item => item.label === projectLabel);
if (!existingLibraryRoot) {
const projectUri = splittedUri.slice(0, - this.path_offset + 3).join('/') + '/';
const library_root = new LFDataProviderNode(projectLabel, projectUri, LFDataProviderNodeRole.ROOT, this.type, []);
root.children.push(library_root);
root.children!.push(library_root);
return library_root;
}
return existingLibraryRoot;
Expand Down Expand Up @@ -410,9 +410,9 @@ export class LFDataProvider implements vscode.TreeDataProvider<LFDataProviderNod
return;
}
const relativePath = this.getRelativePath(editor.document.uri.fsPath, node.uri.fsPath);
const importText = `import ${node.label.toString()} from "${relativePath}"\n`;
const importText = `import ${node.label!.toString()} from "${relativePath}"\n`;
const position = await this.getTargetPosition(editor.document.uri);
this.addTextOnActiveEditor(editor, position.end, importText);
this.addTextOnActiveEditor(editor, position!.end, importText);
}
}

Expand All @@ -424,14 +424,14 @@ export class LFDataProvider implements vscode.TreeDataProvider<LFDataProviderNod
getHighlightSelection(node: LFDataProviderNode): vscode.Selection {
const editor = vscode.window.activeTextEditor;
if (editor) {
const sel = new vscode.Selection(node.position.start - 1, 0, node.position.start - 1, this.HIGHLIGHT_OFFSET);
const sel = new vscode.Selection(node.position!.start - 1, 0, node.position!.start - 1, this.HIGHLIGHT_OFFSET);
const selectionRange = new vscode.Range(sel.start.line, sel.start.character, sel.end.line, sel.end.character);
const highlighted = editor.document.getText(selectionRange);
const idx = highlighted.indexOf(node.label.toString());
const endIdx = idx + node.label.toString().length;
return new vscode.Selection(node.position.start - 1, idx, node.position.start - 1, endIdx);
const idx = highlighted.indexOf(node.label!.toString());
const endIdx = idx + node.label!.toString().length;
return new vscode.Selection(node.position!.start - 1, idx, node.position!.start - 1, endIdx);
}
return new vscode.Selection(node.position.start - 1, 0, node.position.start - 1, this.HIGHLIGHT_OFFSET);
return new vscode.Selection(node.position!.start - 1, 0, node.position!.start - 1, this.HIGHLIGHT_OFFSET);
}

/**
Expand Down

0 comments on commit 9a74383

Please sign in to comment.