volar-service-prettyhtml 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/index.d.ts +2 -3
- package/out/index.js +32 -31
- package/package.json +3 -3
package/out/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServicePlugin } from '@volar/language-service';
|
|
2
2
|
import * as prettyhtml from '@starptech/prettyhtml';
|
|
3
|
-
export declare function create(configs: NonNullable<Parameters<typeof prettyhtml>[1]>):
|
|
4
|
-
export default create;
|
|
3
|
+
export declare function create(configs: NonNullable<Parameters<typeof prettyhtml>[1]>): ServicePlugin;
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
package/out/index.js
CHANGED
|
@@ -3,39 +3,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.create = void 0;
|
|
4
4
|
const prettyhtml = require("@starptech/prettyhtml");
|
|
5
5
|
function create(configs) {
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
28
|
-
return [{
|
|
29
|
-
newText,
|
|
30
|
-
range: {
|
|
31
|
-
start: document.positionAt(0),
|
|
6
|
+
return {
|
|
7
|
+
create() {
|
|
8
|
+
return {
|
|
9
|
+
provideDocumentFormattingEdits(document, range, options) {
|
|
10
|
+
if (document.languageId !== 'html')
|
|
11
|
+
return;
|
|
12
|
+
const oldRangeText = document.getText(range);
|
|
13
|
+
const newRangeText = prettyhtml(oldRangeText, {
|
|
14
|
+
...configs,
|
|
15
|
+
tabWidth: options.tabSize,
|
|
16
|
+
useTabs: !options.insertSpaces,
|
|
17
|
+
}).contents;
|
|
18
|
+
if (newRangeText === oldRangeText)
|
|
19
|
+
return [];
|
|
20
|
+
const newText = document.getText({
|
|
21
|
+
start: document.positionAt(0),
|
|
22
|
+
end: range.start,
|
|
23
|
+
})
|
|
24
|
+
+ newRangeText
|
|
25
|
+
+ document.getText({
|
|
26
|
+
start: range.end,
|
|
32
27
|
end: document.positionAt(document.getText().length),
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
});
|
|
29
|
+
return [{
|
|
30
|
+
newText,
|
|
31
|
+
range: {
|
|
32
|
+
start: document.positionAt(0),
|
|
33
|
+
end: document.positionAt(document.getText().length),
|
|
34
|
+
},
|
|
35
|
+
}];
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
},
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
41
|
exports.create = create;
|
|
40
|
-
exports.default = create;
|
|
41
42
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "volar-service-prettyhtml",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"description": "Integrate prettyhtml into Volar",
|
|
5
5
|
"homepage": "https://github.com/volarjs/services/tree/master/packages/prettyhtml",
|
|
6
6
|
"bugs": "https://github.com/volarjs/services/issues",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"@starptech/prettyhtml": "^0.10.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@volar/language-service": "
|
|
31
|
+
"@volar/language-service": "2.0.0-alpha.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependenciesMeta": {
|
|
34
34
|
"@volar/language-service": {
|
|
35
35
|
"optional": true
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "8dedd3c6e73740fc7c1fe06df32b727ca504adc0"
|
|
39
39
|
}
|