@herb-tools/language-server 0.8.3 → 0.8.5
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/README.md +15 -34
- package/dist/diagnostics.js +229 -0
- package/dist/diagnostics.js.map +1 -1
- package/dist/document_save_service.js +18 -1
- package/dist/document_save_service.js.map +1 -1
- package/dist/formatting_service.js +3 -0
- package/dist/formatting_service.js.map +1 -1
- package/dist/herb-language-server.js +6170 -5684
- package/dist/herb-language-server.js.map +1 -1
- package/dist/index.cjs +254 -6
- package/dist/index.cjs.map +1 -1
- package/dist/server.js +2 -3
- package/dist/server.js.map +1 -1
- package/dist/settings.js +2 -1
- package/dist/settings.js.map +1 -1
- package/dist/types/diagnostics.d.ts +35 -1
- package/dist/types/document_save_service.d.ts +9 -0
- package/package.json +5 -5
- package/src/diagnostics.ts +299 -1
- package/src/document_save_service.ts +20 -1
- package/src/formatting_service.ts +3 -0
- package/src/server.ts +2 -6
- package/src/settings.ts +2 -1
- package/CHANGELOG.md +0 -7
- package/dist/config.js +0 -73
- package/dist/config.js.map +0 -1
- package/dist/types/config.d.ts +0 -34
- package/src/config.ts +0 -109
package/dist/types/config.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export type HerbConfigOptions = {
|
|
2
|
-
formatter?: {
|
|
3
|
-
enabled?: boolean;
|
|
4
|
-
include?: string[];
|
|
5
|
-
exclude?: string[];
|
|
6
|
-
indentWidth?: number;
|
|
7
|
-
maxLineLength?: number;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export type HerbLSPConfig = {
|
|
11
|
-
version: string;
|
|
12
|
-
createdAt: string;
|
|
13
|
-
updatedAt: string;
|
|
14
|
-
options: HerbConfigOptions;
|
|
15
|
-
};
|
|
16
|
-
export declare class Config {
|
|
17
|
-
static configPath: string;
|
|
18
|
-
readonly path: string;
|
|
19
|
-
config: HerbLSPConfig;
|
|
20
|
-
constructor(projectPath: string, config: HerbLSPConfig);
|
|
21
|
-
get version(): string;
|
|
22
|
-
get createdAt(): Date;
|
|
23
|
-
get updatedAt(): Date;
|
|
24
|
-
get options(): HerbConfigOptions;
|
|
25
|
-
toJSON(): string;
|
|
26
|
-
private updateTimestamp;
|
|
27
|
-
private updateVersion;
|
|
28
|
-
write(): Promise<void>;
|
|
29
|
-
read(): Promise<string>;
|
|
30
|
-
static configPathFromProjectPath(projectPath: string): string;
|
|
31
|
-
static fromPathOrNew(projectPath: string): Promise<Config>;
|
|
32
|
-
static fromPath(projectPath: string): Promise<Config>;
|
|
33
|
-
static newConfig(projectPath: string): Config;
|
|
34
|
-
}
|
package/src/config.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
export type HerbConfigOptions = {
|
|
2
|
-
formatter?: {
|
|
3
|
-
enabled?: boolean
|
|
4
|
-
include?: string[]
|
|
5
|
-
exclude?: string[]
|
|
6
|
-
indentWidth?: number
|
|
7
|
-
maxLineLength?: number
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type HerbLSPConfig = {
|
|
12
|
-
version: string
|
|
13
|
-
createdAt: string
|
|
14
|
-
updatedAt: string
|
|
15
|
-
options: HerbConfigOptions
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
import path from "path"
|
|
19
|
-
import { version } from "../package.json"
|
|
20
|
-
import { promises as fs } from "fs"
|
|
21
|
-
|
|
22
|
-
export class Config {
|
|
23
|
-
static configPath = ".herb-lsp/config.json"
|
|
24
|
-
|
|
25
|
-
public readonly path: string
|
|
26
|
-
public config: HerbLSPConfig
|
|
27
|
-
|
|
28
|
-
constructor(projectPath: string, config: HerbLSPConfig) {
|
|
29
|
-
this.path = Config.configPathFromProjectPath(projectPath)
|
|
30
|
-
this.config = config
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
get version(): string {
|
|
34
|
-
return this.config.version
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
get createdAt(): Date {
|
|
38
|
-
return new Date(this.config.createdAt)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
get updatedAt(): Date {
|
|
42
|
-
return new Date(this.config.updatedAt)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
get options(): HerbConfigOptions {
|
|
46
|
-
return this.config.options
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
public toJSON() {
|
|
50
|
-
return JSON.stringify(this.config, null, " ")
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
private updateTimestamp() {
|
|
54
|
-
this.config.updatedAt = new Date().toISOString()
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
private updateVersion() {
|
|
58
|
-
this.config.version = version
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async write() {
|
|
62
|
-
this.updateVersion()
|
|
63
|
-
this.updateTimestamp()
|
|
64
|
-
|
|
65
|
-
const folder = path.dirname(this.path)
|
|
66
|
-
|
|
67
|
-
fs.stat(folder)
|
|
68
|
-
.then(() => {})
|
|
69
|
-
.catch(async () => await fs.mkdir(folder))
|
|
70
|
-
.finally(async () => await fs.writeFile(this.path, this.toJSON()))
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
async read() {
|
|
74
|
-
return await fs.readFile(this.path, "utf8")
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
static configPathFromProjectPath(projectPath: string) {
|
|
78
|
-
return path.join(projectPath, this.configPath)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
static async fromPathOrNew(projectPath: string) {
|
|
82
|
-
try {
|
|
83
|
-
return await this.fromPath(projectPath)
|
|
84
|
-
} catch {
|
|
85
|
-
return Config.newConfig(projectPath)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
static async fromPath(projectPath: string) {
|
|
90
|
-
const configPath = Config.configPathFromProjectPath(projectPath)
|
|
91
|
-
|
|
92
|
-
try {
|
|
93
|
-
const config = JSON.parse(await fs.readFile(configPath, "utf8"))
|
|
94
|
-
|
|
95
|
-
return new Config(projectPath, config)
|
|
96
|
-
} catch (error: any) {
|
|
97
|
-
throw new Error(`Error reading config file at: ${configPath}. Error: ${error.message}`)
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
static newConfig(projectPath: string): Config {
|
|
102
|
-
return new Config(projectPath, {
|
|
103
|
-
version,
|
|
104
|
-
createdAt: new Date().toISOString(),
|
|
105
|
-
updatedAt: new Date().toISOString(),
|
|
106
|
-
options: {}
|
|
107
|
-
})
|
|
108
|
-
}
|
|
109
|
-
}
|