Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: Source/devtools/front_end/sdk/FileSystemWorkspaceBinding.js

Issue 376163002: DevTools: Search across files should work for file:folderName queries. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 { 349 {
350 var result = []; 350 var result = [];
351 if (content !== null) 351 if (content !== null)
352 result = WebInspector.ContentProvider.performSearchInContent(con tent, query, caseSensitive, isRegex); 352 result = WebInspector.ContentProvider.performSearchInContent(con tent, query, caseSensitive, isRegex);
353 callback(result); 353 callback(result);
354 } 354 }
355 }, 355 },
356 356
357 /** 357 /**
358 * @param {!WebInspector.ProjectSearchConfig} searchConfig 358 * @param {!WebInspector.ProjectSearchConfig} searchConfig
359 * @param {!Array.<string>} filesMathingFileQuery
359 * @param {!WebInspector.Progress} progress 360 * @param {!WebInspector.Progress} progress
360 * @param {function(!Array.<string>)} callback 361 * @param {function(!Array.<string>)} callback
361 */ 362 */
362 findFilesMatchingSearchRequest: function(searchConfig, progress, callback) 363 findFilesMatchingSearchRequest: function(searchConfig, filesMathingFileQuery , progress, callback)
363 { 364 {
364 var result = null; 365 var result = filesMathingFileQuery;
365 var queriesToRun = searchConfig.queries().slice(); 366 var queriesToRun = searchConfig.queries().slice();
366 if (!queriesToRun.length) 367 if (!queriesToRun.length)
367 queriesToRun.push(""); 368 queriesToRun.push("");
368 progress.setTotalWork(queriesToRun.length); 369 progress.setTotalWork(queriesToRun.length);
369 searchNextQuery.call(this); 370 searchNextQuery.call(this);
370 371
371 /** 372 /**
372 * @this {WebInspector.FileSystemWorkspaceBinding.FileSystem} 373 * @this {WebInspector.FileSystemWorkspaceBinding.FileSystem}
373 */ 374 */
374 function searchNextQuery() 375 function searchNextQuery()
375 { 376 {
376 if (!queriesToRun.length) { 377 if (!queriesToRun.length) {
377 matchFileQueries.call(null, result); 378 progress.done();
379 callback(result);
378 return; 380 return;
379 } 381 }
380 var query = queriesToRun.shift(); 382 var query = queriesToRun.shift();
381 this._searchInPath(searchConfig.isRegex() ? "" : query, progress, in nerCallback.bind(this)); 383 this._searchInPath(searchConfig.isRegex() ? "" : query, progress, in nerCallback.bind(this));
382 } 384 }
383 385
384 /** 386 /**
385 * @param {!Array.<string>} files 387 * @param {!Array.<string>} files
386 * @this {WebInspector.FileSystemWorkspaceBinding.FileSystem} 388 * @this {WebInspector.FileSystemWorkspaceBinding.FileSystem}
387 */ 389 */
388 function innerCallback(files) 390 function innerCallback(files)
389 { 391 {
390 files = files.sort(); 392 files = files.sort();
391 progress.worked(1); 393 progress.worked(1);
392 if (!result) 394 result = result.intersectOrdered(files, String.naturalOrderComparato r);
393 result = files;
394 else
395 result = result.intersectOrdered(files, String.naturalOrderCompa rator);
396 searchNextQuery.call(this); 395 searchNextQuery.call(this);
397 } 396 }
398
399 /**
400 * @param {!Array.<string>} files
401 */
402 function matchFileQueries(files)
403 {
404 files = files.filter(searchConfig.filePathMatchesFileQuery.bind(sear chConfig));
405 progress.done();
406 callback(files);
407 }
408 }, 397 },
409 398
410 /** 399 /**
411 * @param {string} query 400 * @param {string} query
412 * @param {!WebInspector.Progress} progress 401 * @param {!WebInspector.Progress} progress
413 * @param {function(!Array.<string>)} callback 402 * @param {function(!Array.<string>)} callback
414 */ 403 */
415 _searchInPath: function(query, progress, callback) 404 _searchInPath: function(query, progress, callback)
416 { 405 {
417 var requestId = this._fileSystemWorkspaceBinding.registerCallback(innerC allback.bind(this)); 406 var requestId = this._fileSystemWorkspaceBinding.registerCallback(innerC allback.bind(this));
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 dispose: function() 582 dispose: function()
594 { 583 {
595 this._workspace.removeProject(this._projectId); 584 this._workspace.removeProject(this._projectId);
596 } 585 }
597 } 586 }
598 587
599 /** 588 /**
600 * @type {!WebInspector.FileSystemWorkspaceBinding} 589 * @type {!WebInspector.FileSystemWorkspaceBinding}
601 */ 590 */
602 WebInspector.fileSystemWorkspaceBinding; 591 WebInspector.fileSystemWorkspaceBinding;
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sdk/ContentProviderBasedProjectDelegate.js ('k') | Source/devtools/front_end/sdk/Workspace.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698