diff --git a/packages/antlr/src/PortugolErrorListener.ts b/packages/antlr/src/PortugolErrorListener.ts index 74af563a..354f60b9 100644 --- a/packages/antlr/src/PortugolErrorListener.ts +++ b/packages/antlr/src/PortugolErrorListener.ts @@ -27,15 +27,14 @@ export class PortugolCodeError extends Error { typeof (possibleContext as unknown as { _stop: any })._stop === "object" ) { const { _start, _stop } = possibleContext as unknown as { _start: any; _stop: any }; + const { line: startLine, _charPositionInLine: startCol } = _start; + let { line: endLine, _charPositionInLine: endCol } = _stop; - return new PortugolCodeError( - message, - ctx, - _start.line, - _start._charPositionInLine + 1, - _stop.line, - _stop._charPositionInLine + 2, - ); + if (startLine === endLine && startCol === endCol) { + endCol += ctx.text.length - 1; + } + + return new PortugolCodeError(message, ctx, startLine, startCol, endLine, endCol); } const possibleSymbol: Token | RuleContext | undefined = (ctx as any).symbol || (ctx as any).payload; @@ -51,9 +50,9 @@ export class PortugolCodeError extends Error { message, ctx, _line, - _charPositionInLine + 1, + _charPositionInLine, _line, - _charPositionInLine + 2 + ctx.text.length, + _charPositionInLine + ctx.text.length, ); } @@ -73,9 +72,7 @@ export class PortugolErrorListener implements ANTLRErrorListener { exception: RecognitionException | undefined, ) { const endColumn = - offendingSymbol && offendingSymbol.text - ? charPositionInLine + offendingSymbol.text.length - : charPositionInLine + 1; + offendingSymbol && offendingSymbol.text ? charPositionInLine + offendingSymbol.text.length : charPositionInLine; this.errors.push( new PortugolCodeError( diff --git a/packages/ide/src/app/dialog-open-example/dialog-open-example.component.html b/packages/ide/src/app/dialog-open-example/dialog-open-example.component.html index c5e73a51..294b51b9 100644 --- a/packages/ide/src/app/dialog-open-example/dialog-open-example.component.html +++ b/packages/ide/src/app/dialog-open-example/dialog-open-example.component.html @@ -13,7 +13,7 @@
  • - {{ node.name }} diff --git a/packages/ide/src/app/dialog-open-example/dialog-open-example.component.ts b/packages/ide/src/app/dialog-open-example/dialog-open-example.component.ts index fdda03d9..ed6898c9 100644 --- a/packages/ide/src/app/dialog-open-example/dialog-open-example.component.ts +++ b/packages/ide/src/app/dialog-open-example/dialog-open-example.component.ts @@ -28,7 +28,7 @@ export class DialogOpenExampleComponent implements OnInit, OnDestroy, AfterViewI treeControl: NestedTreeControl; dataSource: MatTreeNestedDataSource; - current?: ExampleItem; + current: ExampleItem | null = null; loading = true; private _loadSubscription$?: Subscription; diff --git a/packages/ide/src/app/tab-editor/tab-editor.component.ts b/packages/ide/src/app/tab-editor/tab-editor.component.ts index 77e4df2a..3a95f010 100644 --- a/packages/ide/src/app/tab-editor/tab-editor.component.ts +++ b/packages/ide/src/app/tab-editor/tab-editor.component.ts @@ -346,9 +346,9 @@ export class TabEditorComponent implements OnInit, OnDestroy { errors.map(error => { return { startLineNumber: error.startLine, - startColumn: error.startCol, + startColumn: error.startCol + 1, endLineNumber: error.endLine, - endColumn: error.endCol, + endColumn: error.endCol + 2, message: error.message, severity: monaco.MarkerSeverity.Error, }; diff --git a/packages/ide/src/app/tab-start/tab-start.component.html b/packages/ide/src/app/tab-start/tab-start.component.html index 0c86bd83..c6431c70 100644 --- a/packages/ide/src/app/tab-start/tab-start.component.html +++ b/packages/ide/src/app/tab-start/tab-start.component.html @@ -69,9 +69,9 @@

    📰  Novidades

    +

    26/12/2023: Melhorias nas verificações de erros (escopos e tipos)

    15/10/2023: Correção de verificação simples de retorno de função

    11/10/2023: Correção de quebra de linha após execução da função leia()

    -

    28/09/2023: Correção de uso excessivo de recursos ao usar atribuições.