Skip to content

Commit

Permalink
fix: pug auto-import in new line monkey fix not working
Browse files Browse the repository at this point in the history
close #916
  • Loading branch information
johnsoncodehk committed Apr 22, 2022
1 parent 8c54c25 commit 89d3e9c
Showing 1 changed file with 14 additions and 14 deletions.
Expand Up @@ -32,6 +32,20 @@ export function register(context: LanguageServiceRuntimeContext) {
: undefined;
const resolvedItem = await plugin.complete.resolve(originalItem, newPosition_2);

// fix https://github.com/johnsoncodehk/volar/issues/916
if (resolvedItem.additionalTextEdits) {
for (const edit of resolvedItem.additionalTextEdits) {
if (
edit.range.start.line === 0
&& edit.range.start.character === 0
&& edit.range.end.line === 0
&& edit.range.end.character === 0
) {
edit.newText = '\n' + edit.newText;
}
}
}

item = transformCompletionItem(
resolvedItem,
embeddedRange => plugin.resolveEmbeddedRange?.(embeddedRange)
Expand All @@ -44,20 +58,6 @@ export function register(context: LanguageServiceRuntimeContext) {
}
}

// fix https://github.com/johnsoncodehk/volar/issues/916
if (item.additionalTextEdits) {
for (const edit of item.additionalTextEdits) {
if (
edit.range.start.line === 0
&& edit.range.start.character === 0
&& edit.range.end.line === 0
&& edit.range.end.character === 0
) {
edit.newText = '\n' + edit.newText;
}
}
}

// TODO: monky fix import ts file icon
if (item.detail !== item.detail + '.ts') {
item.detail = item.detail;
Expand Down

0 comments on commit 89d3e9c

Please sign in to comment.