Skip to content

Commit

Permalink
Merge pull request #227653 from tmm1/watch-library-failsafe
Browse files Browse the repository at this point in the history
Ignore tsserver requests for createDirectoryWatcher(~/Library) on macOS
  • Loading branch information
bpasero authored Sep 5, 2024
2 parents 476c4d9 + 39c063b commit 7bb0026
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import * as path from 'path';
import * as vscode from 'vscode';
import { homedir } from 'os';
import { ServiceConfigurationProvider, SyntaxServerConfiguration, TsServerLogLevel, TypeScriptServiceConfiguration, areServiceConfigurationsEqual } from './configuration/configuration';
import * as fileSchemes from './configuration/fileSchemes';
import { Schemes } from './configuration/schemes';
Expand Down Expand Up @@ -1038,15 +1039,20 @@ export default class TypeScriptServiceClient extends Disposable implements IType
return;

case EventName.createDirectoryWatcher: {
const path = (event.body as Proto.CreateDirectoryWatcherEventBody).path;
if (path.startsWith(inMemoryResourcePrefix)) {
const fpath = (event.body as Proto.CreateDirectoryWatcherEventBody).path;
if (fpath.startsWith(inMemoryResourcePrefix)) {
return;
}
if (process.platform === 'darwin' && fpath === path.join(homedir(), 'Library')) {
// ignore directory watch requests on ~/Library
// until microsoft/TypeScript#59831 is resolved
return;
}

this.createFileSystemWatcher(
(event.body as Proto.CreateDirectoryWatcherEventBody).id,
new vscode.RelativePattern(
vscode.Uri.file(path),
vscode.Uri.file(fpath),
(event.body as Proto.CreateDirectoryWatcherEventBody).recursive ? '**' : '*'
),
(event.body as Proto.CreateDirectoryWatcherEventBody).ignoreUpdate
Expand Down

0 comments on commit 7bb0026

Please sign in to comment.