Skip to content

Commit b11b421

Browse files
committed
add formatted source files
1 parent 8747c55 commit b11b421

File tree

162 files changed

+21991
-21991
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+21991
-21991
lines changed

packages/language-server/src/importPackage.ts

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,46 @@ import { Logger } from './logger';
1010
* so it's not transformed.
1111
*/
1212
function dynamicRequire(dynamicFileToRequire: string): any {
13-
// prettier-ignore
14-
return require(dynamicFileToRequire);
13+
// prettier-ignore
14+
return require(dynamicFileToRequire);
1515
}
1616

1717
export function getPackageInfo(packageName: string, fromPath: string) {
18-
const packageJSONPath = require.resolve(`${packageName}/package.json`, {
19-
paths: [fromPath, __dirname]
20-
});
21-
// eslint-disable-next-line @typescript-eslint/no-var-requires
22-
const { version } = dynamicRequire(packageJSONPath);
23-
const [major, minor, patch] = version.split('.');
18+
const packageJSONPath = require.resolve(`${packageName}/package.json`, {
19+
paths: [fromPath, __dirname]
20+
});
21+
// eslint-disable-next-line @typescript-eslint/no-var-requires
22+
const { version } = dynamicRequire(packageJSONPath);
23+
const [major, minor, patch] = version.split('.');
2424

25-
return {
26-
path: dirname(packageJSONPath),
27-
version: {
28-
full: version,
29-
major,
30-
minor,
31-
patch
32-
}
33-
};
25+
return {
26+
path: dirname(packageJSONPath),
27+
version: {
28+
full: version,
29+
major,
30+
minor,
31+
patch
32+
}
33+
};
3434
}
3535

3636
export function importPrettier(fromPath: string): typeof prettier {
37-
const pkg = getPackageInfo('prettier', fromPath);
38-
const main = resolve(pkg.path);
39-
Logger.log('Using Prettier v' + pkg.version.full, 'from', main);
40-
return dynamicRequire(main);
37+
const pkg = getPackageInfo('prettier', fromPath);
38+
const main = resolve(pkg.path);
39+
Logger.log('Using Prettier v' + pkg.version.full, 'from', main);
40+
return dynamicRequire(main);
4141
}
4242

4343
export function importSvelte(fromPath: string): typeof svelte {
44-
const pkg = getPackageInfo('svelte', fromPath);
45-
const main = resolve(pkg.path, 'compiler');
46-
Logger.log('Using Svelte v' + pkg.version.full, 'from', main);
47-
return dynamicRequire(main);
44+
const pkg = getPackageInfo('svelte', fromPath);
45+
const main = resolve(pkg.path, 'compiler');
46+
Logger.log('Using Svelte v' + pkg.version.full, 'from', main);
47+
return dynamicRequire(main);
4848
}
4949

5050
export function importSveltePreprocess(fromPath: string): typeof sveltePreprocess {
51-
const pkg = getPackageInfo('svelte-preprocess', fromPath);
52-
const main = resolve(pkg.path);
53-
Logger.log('Using svelte-preprocess v' + pkg.version.full, 'from', main);
54-
return dynamicRequire(main);
51+
const pkg = getPackageInfo('svelte-preprocess', fromPath);
52+
const main = resolve(pkg.path);
53+
Logger.log('Using svelte-preprocess v' + pkg.version.full, 'from', main);
54+
return dynamicRequire(main);
5555
}

packages/language-server/src/lib/DiagnosticsManager.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@ export type SendDiagnostics = _Connection['sendDiagnostics'];
55
export type GetDiagnostics = (doc: TextDocumentIdentifier) => Thenable<Diagnostic[]>;
66

77
export class DiagnosticsManager {
8-
constructor(
9-
private sendDiagnostics: SendDiagnostics,
10-
private docManager: DocumentManager,
11-
private getDiagnostics: GetDiagnostics
12-
) {}
8+
constructor(
9+
private sendDiagnostics: SendDiagnostics,
10+
private docManager: DocumentManager,
11+
private getDiagnostics: GetDiagnostics
12+
) {}
1313

14-
updateAll() {
15-
this.docManager.getAllOpenedByClient().forEach((doc) => {
16-
this.update(doc[1]);
17-
});
18-
}
14+
updateAll() {
15+
this.docManager.getAllOpenedByClient().forEach((doc) => {
16+
this.update(doc[1]);
17+
});
18+
}
1919

20-
async update(document: Document) {
21-
const diagnostics = await this.getDiagnostics({ uri: document.getURL() });
22-
this.sendDiagnostics({
23-
uri: document.getURL(),
24-
diagnostics
25-
});
26-
}
20+
async update(document: Document) {
21+
const diagnostics = await this.getDiagnostics({ uri: document.getURL() });
22+
this.sendDiagnostics({
23+
uri: document.getURL(),
24+
diagnostics
25+
});
26+
}
2727

28-
removeDiagnostics(document: Document) {
29-
this.sendDiagnostics({
30-
uri: document.getURL(),
31-
diagnostics: []
32-
});
33-
}
28+
removeDiagnostics(document: Document) {
29+
this.sendDiagnostics({
30+
uri: document.getURL(),
31+
diagnostics: []
32+
});
33+
}
3434
}

packages/language-server/src/lib/FallbackWatcher.ts

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,39 @@ import { pathToUrl } from '../utils';
66
type DidChangeHandler = (para: DidChangeWatchedFilesParams) => void;
77

88
export class FallbackWatcher {
9-
private readonly watcher: FSWatcher;
10-
private readonly callbacks: DidChangeHandler[] = [];
11-
12-
constructor(glob: string, workspacePaths: string[]) {
13-
this.watcher = watch(workspacePaths.map((workspacePath) => join(workspacePath, glob)));
14-
15-
this.watcher
16-
.on('add', (path) => this.callback(path, FileChangeType.Created))
17-
.on('unlink', (path) => this.callback(path, FileChangeType.Deleted))
18-
.on('change', (path) => this.callback(path, FileChangeType.Changed));
19-
}
20-
21-
private convert(path: string, type: FileChangeType): DidChangeWatchedFilesParams {
22-
const event: FileEvent = {
23-
type,
24-
uri: pathToUrl(path)
25-
};
26-
27-
return {
28-
changes: [event]
29-
};
30-
}
31-
32-
private callback(path: string, type: FileChangeType) {
33-
const para = this.convert(path, type);
34-
this.callbacks.forEach((callback) => callback(para));
35-
}
36-
37-
onDidChangeWatchedFiles(callback: DidChangeHandler) {
38-
this.callbacks.push(callback);
39-
}
40-
41-
dispose() {
42-
this.watcher.close();
43-
}
9+
private readonly watcher: FSWatcher;
10+
private readonly callbacks: DidChangeHandler[] = [];
11+
12+
constructor(glob: string, workspacePaths: string[]) {
13+
this.watcher = watch(workspacePaths.map((workspacePath) => join(workspacePath, glob)));
14+
15+
this.watcher
16+
.on('add', (path) => this.callback(path, FileChangeType.Created))
17+
.on('unlink', (path) => this.callback(path, FileChangeType.Deleted))
18+
.on('change', (path) => this.callback(path, FileChangeType.Changed));
19+
}
20+
21+
private convert(path: string, type: FileChangeType): DidChangeWatchedFilesParams {
22+
const event: FileEvent = {
23+
type,
24+
uri: pathToUrl(path)
25+
};
26+
27+
return {
28+
changes: [event]
29+
};
30+
}
31+
32+
private callback(path: string, type: FileChangeType) {
33+
const para = this.convert(path, type);
34+
this.callbacks.forEach((callback) => callback(para));
35+
}
36+
37+
onDidChangeWatchedFiles(callback: DidChangeHandler) {
38+
this.callbacks.push(callback);
39+
}
40+
41+
dispose() {
42+
this.watcher.close();
43+
}
4444
}

0 commit comments

Comments
 (0)