From f3c203f15a65352e4588ef3b3e04a1ab12bddc03 Mon Sep 17 00:00:00 2001 From: Jiayin Pei Date: Thu, 30 Aug 2018 21:55:56 +0800 Subject: [PATCH] revert change on server.ts --- src/server.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/server.ts b/src/server.ts index b3a3a46d..e0a868a3 100755 --- a/src/server.ts +++ b/src/server.ts @@ -489,22 +489,17 @@ function completionHelper(document: TextDocument, textDocumentPosition: Position //We need to add the ":" to load the nodes let newText = ""; - let appendString = ""; - let lastLineTrimmedText = document.getText().substring(lineOffset[linePos - 1], lineOffset[linePos]).trim(); - if (!lastLineTrimmedText.startsWith("-") || lastLineTrimmedText.indexOf(':')) { - appendString = ":"; - } //This is for the empty line case let trimmedText = textLine.trim(); - if (trimmedText.length === 0 || (trimmedText.length === 1 && trimmedText[0] === '-')) { + if(trimmedText.length === 0 || (trimmedText.length === 1 && trimmedText[0] === '-')){ //Add a temp node that is in the document but we don't use at all. - newText = document.getText().substring(0, start + textLine.length) + ` holder${appendString}\r\n` + document.getText().substr(lineOffset[linePos + 1] || document.getText().length); + newText = document.getText().substring(0, start+textLine.length) + " holder:\r\n" + document.getText().substr(lineOffset[linePos+1] || document.getText().length); - //For when missing semi colon case - } else { + //For when missing semi colon case + }else{ //Add a semicolon to the end of the current line so we can validate the node - newText = document.getText().substring(0, start + textLine.length) + `${appendString}\r\n` + document.getText().substr(lineOffset[linePos + 1] || document.getText().length); + newText = document.getText().substring(0, start+textLine.length) + ":\r\n" + document.getText().substr(lineOffset[linePos+1] || document.getText().length); } return {