This commit is contained in:
2024-01-02 22:32:24 +05:30
parent 0a2a6c4db6
commit fc7e3b431f
8 changed files with 178 additions and 192 deletions

View File

@@ -4,9 +4,9 @@ import { bfVisitor } from './generated/bfVisitor';
import { DiagnosticSeverity } from 'vscode-languageclient';
import { getTree } from './BranFlakesParseRunner';
import { RuleNode } from 'antlr4ts/tree/RuleNode';
import InputStrategy from './input/InputStrategy';
import type InputStrategy from './input/InputStrategy';
export default class BranFlakesExecutorVisitor
export class BranFlakesExecutorVisitor
extends AbstractParseTreeVisitor<Promise<void>>
implements bfVisitor<Promise<void>>
{

View File

@@ -0,0 +1,4 @@
export interface BranFlakesCommand {
getCommandName(): string;
getCommandHandler(): (...args: any) => Promise<any>;
}

View File

@@ -1,5 +0,0 @@
export interface Command{
getCommandName():string;
getCommandHandler():(...args:any)=>Promise<any>;
}

View File

@@ -1,7 +1,6 @@
import { window } from 'vscode';
import { Command as BranFlakesCommand } from './Command';
import type { BranFlakesCommand } from './BranFlakesCommand';
import { VSCodePromptInputStrategy } from '../input/VSCodePromptInputStrategy';
import BranFlakesExecutorVisitor from '../BranFlakesExecutorVisitor';
export class CompileBranFlakesCommand implements BranFlakesCommand {
getCommandName() {
@@ -14,6 +13,10 @@ export class CompileBranFlakesCommand implements BranFlakesCommand {
const inputStrategy = new VSCodePromptInputStrategy(
window.showInputBox
);
const { BranFlakesExecutorVisitor } = await import(
'../BranFlakesExecutorVisitor'
);
const output = await BranFlakesExecutorVisitor.run(
text,
fn,

View File

@@ -4,14 +4,15 @@
* ------------------------------------------------------------------------------------------ */
import * as path from 'path';
import { ExtensionContext, commands, window } from 'vscode';
import { commands } from 'vscode';
import type { ExtensionContext } from 'vscode';
import {
LanguageClient,
LanguageClientOptions,
ServerOptions,
TransportKind,
} from 'vscode-languageclient';
import { CompileBranFlakesCommand } from './command/CompileCommand';
import { CompileBranFlakesCommand } from './command/CompileBranFlakesCommand';
let client: LanguageClient;

View File

@@ -1,5 +1,5 @@
import { CancellationToken, InputBoxOptions } from 'vscode';
import InputStrategy from './InputStrategy';
import type { CancellationToken, InputBoxOptions } from 'vscode';
import type InputStrategy from './InputStrategy';
export class VSCodePromptInputStrategy implements InputStrategy {
private inputQueue: string = '';