Skip to content

Commit

Permalink
fix: document escape
Browse files Browse the repository at this point in the history
  • Loading branch information
weirongxu committed Jun 1, 2019
1 parent fbebe1f commit 9645b6a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CalcProvider implements CompletionItemProvider {
): ProviderResult<CompletionItem[]> {
const startPosition = Position.create(position.line, 0);
const text = document.getText(Range.create(startPosition, position));
if (!text.trim().endsWith('=')) {
if (!text.trimRight().endsWith('=')) {
return [];
}
try {
Expand All @@ -54,12 +54,12 @@ class CalcProvider implements CompletionItemProvider {
// position.line,
// position.character
// )));
const newText = text.endsWith(' ') ? result : ' ' + result;
const newText: string = text.endsWith(' =') ? ' ' + result : result;
return [
{
label: result,
kind: CompletionItemKind.Constant,
documentation: text.slice(skip) + newText,
documentation: '`' + text.slice(skip).trimLeft() + newText + '`',
textEdit: {
range: Range.create(
position.line,
Expand Down

0 comments on commit 9645b6a

Please sign in to comment.