-
Notifications
You must be signed in to change notification settings - Fork 2
/
domain.js
38 lines (32 loc) · 1006 Bytes
/
domain.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* eslint-env node */
"use strict";
var DOMAIN_NAME = "hirseDetectIndentation";
var detectIndent = require("detect-indent");
function detectIndentation(text) {
return detectIndent(text);
}
function init(domainManager) {
if (!domainManager.hasDomain(DOMAIN_NAME)) {
domainManager.registerDomain(DOMAIN_NAME, {
major: 0,
minor: 1
});
}
domainManager.registerCommand(
DOMAIN_NAME, // domain name
"detectIndentation", // command name
detectIndentation, // command handler function
false, // this command is synchronous in Node
"Detect the indentation of code",
[{
name: "text", // parameters
type: "string",
description: "Text to detect the indentation"
}], [{
name: "indent", // return values
type: "object",
description: "Stats about the indentation: amount, type, and indent"
}]
);
}
exports.init = init;