@@ -1119,9 +1119,9 @@ export class CppProperties {
11191119 this . compileCommandsFileWatcher ?. close ( ) ;
11201120 this . compileCommandsFileWatcher = undefined ;
11211121
1122- // check if the current configuration is using a configuration provider (e.g `CMake Tools`)
1123- // if so, avoid setting up a `compile_commands.json` file watcher to avoid unnessary parsing
1124- // by the language server
1122+ // Check if the current configuration is using a configuration provider. (e.g `CMake Tools`)
1123+ // If so, avoid setting up a `compile_commands.json` file watcher to avoid unnessary parsing
1124+ // by the language server.
11251125 if ( this . CurrentConfiguration ?. configurationProvider && ! this . configurationProviderFailedToProvide ) {
11261126 return ;
11271127 }
@@ -1136,9 +1136,9 @@ export class CppProperties {
11361136 clearInterval ( this . compileCommandsFileWatcherTimer ) ;
11371137 this . compileCommandsFileWatcherTimer = undefined ;
11381138
1139- // if the file was deleted/renamed,
1140- // linux based systems lose track of the file (inode deleted)
1141- // we need to close the watcher and wait until file is created again
1139+ // If the file was deleted/renamed,
1140+ // Linux based systems lose track of the file. (inode deleted)
1141+ // We need to close the watcher and wait until file is created again.
11421142 if ( eventType === "rename" ) {
11431143 this . compileCommandsFileWatcher ?. close ( ) ;
11441144 this . compileCommandsFileWatcher = undefined ;
@@ -1148,9 +1148,9 @@ export class CppProperties {
11481148 } ) ;
11491149 }
11501150 catch ( e : any ) {
1151- // either file not created or too many watchers
1152- // rely on polling until the file is created
1153- // then , file watching will be attempted again
1151+ // Either file not created or too many active watchers.
1152+ // Rely on polling until the file is created.
1153+ // Then , file watching will be attempted again.
11541154 this . compileCommandsFileWatcher ?. close ( ) ;
11551155 this . compileCommandsFileWatcher = undefined ;
11561156 }
@@ -2302,8 +2302,10 @@ export class CppProperties {
23022302 }
23032303
23042304 /**
2305- * if `configurationProvider` is set, we don't watch for changes in the `compileCommands` file.
2306- * calling this function means we need to start checking it.
2305+ * Configuration provider failed to provide for some file.
2306+ * This is used to determine if we should start watching for changes in the `compileCommands` file.
2307+ *
2308+ * NOTE: This is only used when `configurationProvider` is set.
23072309 */
23082310 public configurationProviderFailed ( ) : void {
23092311 this . configurationProviderFailedToProvide = true ;
@@ -2313,9 +2315,9 @@ export class CppProperties {
23132315 * Manually check for changes in the compileCommands file.
23142316 *
23152317 * NOTE: The check is skipped on any of the following terms:
2316- * - There is an active `compile_commands.json` file watcher
2317- * - The `configurationProvider` property is set and `configurationProviderFailed()` was not called
2318- * - The `compileCommands` property is not set
2318+ * - There is an active `compile_commands.json` file watcher.
2319+ * - The `configurationProvider` property is set and `configurationProviderFailed()` was not called.
2320+ * - The `compileCommands` property is not set.
23192321 */
23202322 public checkCompileCommands ( ) : void {
23212323 if ( this . compileCommandsFileWatcher !== undefined ) {
@@ -2341,7 +2343,7 @@ export class CppProperties {
23412343 catch ( err : any ) {
23422344 if ( err . code === "ENOENT" && this . compileCommandsFile ) {
23432345 this . onCompileCommandsChanged ( compileCommandsFile ) ;
2344- this . compileCommandsFile = undefined ; // File deleted
2346+ this . compileCommandsFile = undefined ; // File deleted.
23452347 }
23462348 }
23472349
0 commit comments