Skip to content

Commit

Permalink
Ignore tsserver requests for createDirectoryWatcher(~/Library) on m…
Browse files Browse the repository at this point in the history
…acOS (microsoft#227788)

* Ignore tsserver requests for createDirectoryWatcher(~/Library) on macOS

* update deps

---------

Co-authored-by: Aman Karmani <[email protected]>
  • Loading branch information
bpasero and tmm1 authored Sep 6, 2024
1 parent 51b69d4 commit 6f1101d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions extensions/shared.webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ function withBrowserDefaults(/**@type WebpackConfig & { context: string }*/extCo
extensions: ['.ts', '.js'], // support ts-files and js-files
fallback: {
'path': require.resolve('path-browserify'),
'os': require.resolve('os-browserify'),
'util': require.resolve('util')
}
},
Expand Down
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
7 changes: 7 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
"opn": "^6.0.0",
"p-all": "^1.0.0",
"path-browserify": "^1.0.1",
"os-browserify": "^0.3.0",
"postcss": "^8.4.33",
"postcss-nesting": "^12.0.2",
"pump": "^1.0.1",
Expand Down

0 comments on commit 6f1101d

Please sign in to comment.