Skip to content

Commit 7f2c424

Browse files
committed
chore: utils
1 parent 7a79560 commit 7f2c424

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

src/utils/commands.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { hasServerDir } from "../utils";
2+
const serverDir = hasServerDir();
23

34
const getCommandType = (commandType: string) => {
45
let type = {
@@ -59,28 +60,28 @@ const getCommandType = (commandType: string) => {
5960
case 'api':
6061
type = {
6162
name: 'APIs',
62-
path: `${hasServerDir()}/api`,
63+
path: `${serverDir}/api`,
6364
extension: '.ts',
6465
};
6566
break;
6667
case 'route':
6768
type = {
6869
name: 'Routes',
69-
path: `${hasServerDir()}/routes`,
70+
path: `${serverDir}/routes`,
7071
extension: '.ts',
7172
};
7273
break;
7374
case 'nitroPlugin':
7475
type = {
7576
name: 'Plugins',
76-
path: `${hasServerDir()}/plugins`,
77+
path: `${serverDir}/plugins`,
7778
extension: '.ts',
7879
};
7980
break;
8081
case 'nitroMiddleware':
8182
type = {
8283
name: 'Middleware',
83-
path: `${hasServerDir()}/middleware`,
84+
path: `${serverDir}/middleware`,
8485
extension: '.ts',
8586
};
8687
break;
@@ -94,7 +95,7 @@ const getCommandType = (commandType: string) => {
9495
case 'nitroUtil':
9596
type = {
9697
name: 'Utility',
97-
path: `${hasServerDir()}/utils`,
98+
path: `${serverDir}/utils`,
9899
extension: '.ts',
99100
};
100101
break;

src/utils/vscode.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
import { DocumentSelector, workspace, Uri, FileType } from 'vscode';
22

3-
export const languageSelector = (language: string): DocumentSelector => ({
4-
scheme: 'file',
5-
language,
6-
} as const);
3+
export const languageSelector = (language: string): DocumentSelector => ({ scheme: 'file', language, } as const);
74

8-
export const patternSelector = (pattern: string): DocumentSelector => ({
9-
scheme: 'file',
10-
pattern,
11-
} as const);
5+
export const patternSelector = (pattern: string): DocumentSelector => ({ scheme: 'file', pattern, } as const);
126

137
export async function pathExists(localPath: string): Promise<boolean> {
148
try {

src/utils/watchers.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { workspace, window, commands, ConfigurationChangeEvent, Disposable } fro
33
export function createConfigWatcher(configKey: string, callback?: () => Promise<void>, defaultBehavior?: boolean): Disposable {
44
const watcher = workspace.onDidChangeConfiguration(async (event: ConfigurationChangeEvent) => {
55
if (event.affectsConfiguration(configKey)) {
6-
// Execute the provided callback when the configuration changes.
76
if (callback && typeof callback === 'function') {
87
await callback();
98
}
@@ -24,6 +23,5 @@ export function createConfigWatcher(configKey: string, callback?: () => Promise<
2423
}
2524
});
2625

27-
// Return a Disposable object that can be used to stop watching for changes.
2826
return watcher;
2927
}

0 commit comments

Comments
 (0)