Skip to content

Commit

Permalink
Fixing merge errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbvz committed Jul 17, 2023
1 parent 570b609 commit 328f018
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions extensions/typescript-language-features/web/webServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,10 @@ function createServerHost(extensionUri: URI, logger: ts.server.Logger, apiClient

watchFiles.set(path, { path, callback, pollingInterval, options });
const watchIds = [++watchId];
const res = toResource(path);
fsWatcher.postMessage({ type: 'watchFile', uri: res, id: watchIds[0] });
fsWatcher.postMessage({ type: 'watchFile', uri: uri, id: watchIds[0] });
if (enabledExperimentalTypeAcquisition && looksLikeNodeModules(path)) {
watchIds.push(++watchId);
fsWatcher.postMessage({ type: 'watchFile', uri: mapUri(res, 'vscode-node-modules'), id: watchIds[1] });
fsWatcher.postMessage({ type: 'watchFile', uri: mapUri(uri, 'vscode-node-modules'), id: watchIds[1] });
}
return {
close() {
Expand All @@ -147,9 +146,17 @@ function createServerHost(extensionUri: URI, logger: ts.server.Logger, apiClient
watchDirectory(path: string, callback: ts.DirectoryWatcherCallback, recursive?: boolean, options?: ts.WatchOptions): ts.FileWatcher {
logVerbose('fs.watchDirectory', { path });

let uri: URI;
try {
uri = toResource(path);
} catch (e) {
console.error(e);
return noopWatcher;
}

watchDirectories.set(path, { path, callback, recursive, options });
watchId++;
fsWatcher.postMessage({ type: 'watchDirectory', recursive, uri: toResource(path), id: watchId });
const watchIds = [++watchId];
fsWatcher.postMessage({ type: 'watchDirectory', recursive, uri, id: watchId });
return {
close() {
logVerbose('fs.watchDirectory.close', { path });
Expand Down

0 comments on commit 328f018

Please sign in to comment.