From 5d64d00fe54d649d0519a3e9f018a1f71cee693b Mon Sep 17 00:00:00 2001 From: Christoph Schlosser Date: Sat, 20 Oct 2018 15:54:23 +0200 Subject: Get logical line for python function --- src/CodeParserController.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/CodeParserController.ts') diff --git a/src/CodeParserController.ts b/src/CodeParserController.ts index 4e38f06..a4b4748 100644 --- a/src/CodeParserController.ts +++ b/src/CodeParserController.ts @@ -114,15 +114,19 @@ export default class CodeParserController { } const lang: string = activeEditor.document.languageId; + const currentPos: Position = window.activeTextEditor.selection.active; let parser: CodeParser; + let endPos: number; switch (lang) { case "c": case "cpp": parser = new CppParser(this.cfg); + endPos = currentPos.character - this.cfg.C.triggerSequence.length; break; case "python": parser = new PythonParser(this.cfg); + endPos = currentPos.character - this.cfg.Python.triggerSequence.length; break; default: // tslint:disable-next-line:no-console @@ -130,10 +134,9 @@ export default class CodeParserController { return null; } - const currentPos: Position = window.activeTextEditor.selection.active; const startReplace: Position = new Position( currentPos.line, - currentPos.character - this.cfg.C.triggerSequence.length, + endPos, ); const nextLineText: string = window.activeTextEditor.document.lineAt(startReplace.line + 1).text; -- cgit v1.2.3