volar-service-pug-beautify
Advanced tools
Comparing version 0.0.34 to 0.0.35
@@ -1,7 +0,7 @@ | ||
import type { DocumentSelector, FormattingOptions, Result, ServiceContext, ServicePlugin, TextDocument } from '@volar/language-service'; | ||
import type { DocumentSelector, FormattingOptions, ProviderResult, ServiceContext, LanguageServicePlugin, TextDocument } from '@volar/language-service'; | ||
export declare function create({ documentSelector, isFormattingEnabled, getFormattingOptions, }?: { | ||
documentSelector?: DocumentSelector; | ||
isFormattingEnabled?(document: TextDocument, context: ServiceContext): Result<boolean>; | ||
getFormattingOptions?(document: TextDocument, options: FormattingOptions, context: ServiceContext): Result<{}>; | ||
}): ServicePlugin; | ||
isFormattingEnabled?(document: TextDocument, context: ServiceContext): ProviderResult<boolean>; | ||
getFormattingOptions?(document: TextDocument, options: FormattingOptions, context: ServiceContext): ProviderResult<{}>; | ||
}): LanguageServicePlugin; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -15,10 +15,13 @@ "use strict"; | ||
async provideDocumentFormattingEdits(document, range, options) { | ||
if (!matchDocument(documentSelector, document)) | ||
if (!matchDocument(documentSelector, document)) { | ||
return; | ||
if (!await isFormattingEnabled(document, context)) | ||
} | ||
if (!await isFormattingEnabled(document, context)) { | ||
return; | ||
} | ||
const pugCode = document.getText(range); | ||
// fix https://github.com/johnsoncodehk/volar/issues/304 | ||
if (pugCode.trim() === '') | ||
if (pugCode.trim() === '') { | ||
return; | ||
} | ||
const pugBeautify = require('@johnsoncodehk/pug-beautify'); | ||
@@ -25,0 +28,0 @@ const prefixesLength = pugCode.length - pugCode.trimStart().length; |
{ | ||
"name": "volar-service-pug-beautify", | ||
"version": "0.0.34", | ||
"version": "0.0.35", | ||
"description": "Integrate pug-beautify into Volar", | ||
@@ -30,3 +30,3 @@ "homepage": "https://github.com/volarjs/services/tree/master/packages/pug-beautify", | ||
"peerDependencies": { | ||
"@volar/language-service": "~2.1.0" | ||
"@volar/language-service": "~2.2.0-alpha.0" | ||
}, | ||
@@ -41,3 +41,3 @@ "peerDependenciesMeta": { | ||
}, | ||
"gitHead": "aafefd1d65541462b3e99208f14dbb2cd8477ae9" | ||
"gitHead": "cbd8ef0ada6eae9656286535599c9b289134d1e3" | ||
} |
5125
56