Skip to content

Commit 1e952d4

Browse files
committed
updated transpiler ver, no hover if parserErrors
1 parent 6ece4cc commit 1e952d4

File tree

8 files changed

+23
-14
lines changed

8 files changed

+23
-14
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to the "bitloops-language" extension will be documented in t
44

55
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
66

7+
### 0.4.5
8+
9+
Updated version of bitloops-transpiler, no hover if there are syntactic errors.
10+
711
### 0.4.4
812

913
Fixed bug of hover.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ No known issues.
3333

3434
## What's New
3535

36-
### 0.4.4
36+
### 0.4.5
3737

38-
Fixed bug of hover.
38+
Updated version of bitloops-transpiler, no hover if there are syntactic errors.
3939

4040
---
4141

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"icon": "assets/images/bitloops-language-logo-256x256.png",
1111
"license": "MIT",
12-
"version": "0.4.4",
12+
"version": "0.4.5",
1313
"scripts": {
1414
"vs:package": "vsce package",
1515
"vs:publish": "vsce publish",

server/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bitloops-lsp-server",
33
"description": "BitLoops Language Server",
4-
"version": "0.4.4",
4+
"version": "0.4.5",
55
"publisher": "Bitloops",
66
"license": "MIT",
77
"engines": {
@@ -10,7 +10,7 @@
1010
"type": "module",
1111
"scripts": {},
1212
"dependencies": {
13-
"@bitloops/bl-transpiler": "^0.6.11",
13+
"@bitloops/bl-transpiler": "^0.7.0",
1414
"debounce": "^1.2.1",
1515
"fs": "^0.0.1-security",
1616
"path": "^0.12.7",

server/src/lsp/handlers/document-text-changed-handler/bitloops-transpiler-analyzer.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { TFileId } from '../../../types.js';
1616
import { StateManager, TFileDiagnostics } from '../../services/StateManager.js';
1717

1818
export class BitloopsAnalyzer implements IAnalyzer {
19-
symbolTable: ParserSyntacticErrors | TSymbolTableSemantics;
19+
symbolTable: TSymbolTableSemantics | null;
2020
constructor(private stateManager: StateManager) {}
2121

2222
analyze(): TFileDiagnostics {
@@ -35,13 +35,14 @@ export class BitloopsAnalyzer implements IAnalyzer {
3535
// 'Info:',
3636
// transpilerInput.core.map((x) => ({ bc: x.boundedContext, mod: x.module })),
3737
// );
38-
this.symbolTable = transpiler.getSymbolTable(transpilerInput);
38+
this.symbolTable = transpiler.getSymbolTable(transpilerInput) as TSymbolTableSemantics;
3939

4040
const intermediateModelOrErrors = transpiler.bitloopsCodeToIntermediateModel(transpilerInput);
4141
if (Transpiler.isTranspilerError(intermediateModelOrErrors)) {
4242
this.mapTranspilerErrorsToLSPDiagnostics(intermediateModelOrErrors);
4343
return this.stateManager.getDiagnostics();
4444
}
45+
4546
console.log('Workspace analysis completed without errors');
4647
return this.stateManager.getDiagnostics();
4748
} catch (e) {
@@ -52,6 +53,7 @@ export class BitloopsAnalyzer implements IAnalyzer {
5253

5354
private mapTranspilerErrorsToLSPDiagnostics(transpilerErrors: TranspilerErrors): void {
5455
if (isParserErrors(transpilerErrors)) {
56+
this.symbolTable = null; //symbolTable is not available if there are parser errors
5557
this.mapParserErrorsToLSPDiagnostics(transpilerErrors);
5658
return;
5759
}
@@ -128,7 +130,10 @@ export class BitloopsAnalyzer implements IAnalyzer {
128130
]);
129131
}
130132
}
131-
public getSymbolTable(): ParserSyntacticErrors | TSymbolTableSemantics {
133+
public getSymbolTable(): TSymbolTableSemantics | null {
134+
if (!this.symbolTable) {
135+
return null;
136+
}
132137
return this.symbolTable;
133138
}
134139
}

server/src/lsp/handlers/document-text-changed-handler/interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ export interface IAnalyzer {
66
* It analyzes the document and returns a list of diagnostics.
77
*/
88
analyze(): TFileDiagnostics;
9-
getSymbolTable(): ParserSyntacticErrors | TSymbolTableSemantics;
9+
getSymbolTable(): TSymbolTableSemantics | null;
1010
}

server/src/lsp/handlers/hover-handler/hover.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const handleHover = (
1515
const boundedContext = stateManager.getBoundedContext(params.textDocument.uri);
1616
if (boundedContext === 'unknown') return null; //if the bounded context is unknown, we don't want to have hover provider
1717
let word = findWord(document, position);
18-
const symbolTable = analyzer.getSymbolTable() as TSymbolTableSemantics;
18+
const symbolTable = analyzer.getSymbolTable();
1919
if (!symbolTable) return null;
2020
const testSymbolTable = symbolTable.symbolTables[boundedContext];
2121
const typeOfKeyword = testSymbolTable?.findTypeOfKeyword(word, {

server/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# yarn lockfile v1
33

44

5-
"@bitloops/bl-transpiler@^0.6.11":
6-
version "0.6.11"
7-
resolved "https://registry.yarnpkg.com/@bitloops/bl-transpiler/-/bl-transpiler-0.6.11.tgz#6be3bf6bab6a7915539708a8b18c05d573417227"
8-
integrity sha512-rE39fr4cupvIrkefxY3G0aZQ6eugZK0DXSLL8BOc6vHXNemCJ1Hi1+eDUqurlcv4Wh+AfzCjlaT6F/Xg0M/U2A==
5+
"@bitloops/bl-transpiler@^0.7.0":
6+
version "0.7.0"
7+
resolved "https://registry.yarnpkg.com/@bitloops/bl-transpiler/-/bl-transpiler-0.7.0.tgz#cc63bae8781d8addc830cd266720fa3205c8bdb6"
8+
integrity sha512-9584ZgekEZuOwVF/on/ooGsG1IoLptQk6vuY2uQGGKfknCnE/zY8bITL9PKO2M90RaDQn97vwDqQiYLQD/3AAg==
99
dependencies:
1010
antlr4 "4.11.0"
1111
lodash "^4.17.21"

0 commit comments

Comments
 (0)