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

Unified Diff: Source/devtools/front_end/TextUtils.js

Issue 15986003: DevTools: [CodeMirror] autocompletion for CodeMirrorTextEditor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address comments Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/Settings.js ('k') | Source/devtools/front_end/UISourceCodeFrame.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/TextUtils.js
diff --git a/Source/devtools/front_end/TextUtils.js b/Source/devtools/front_end/TextUtils.js
index e603a0c54226f94ee6e19420eb8ed1abaabf703a..917e91ab26231f37374b372dfbdc5cf04b7bc18f 100644
--- a/Source/devtools/front_end/TextUtils.js
+++ b/Source/devtools/front_end/TextUtils.js
@@ -98,7 +98,24 @@ WebInspector.TextUtils = {
isBraceChar: function(char)
{
return WebInspector.TextUtils.isOpeningBraceChar(char) || WebInspector.TextUtils.isClosingBraceChar(char);
- }
+ },
+
+ textToWords: function(text)
+ {
+ var words = [];
+ var startWord = -1;
+ for(var i = 0; i < text.length; ++i) {
+ if (!WebInspector.TextUtils.isWordChar(text.charAt(i))) {
+ if (startWord !== -1)
+ words.push(text.substring(startWord, i));
+ startWord = -1;
+ } else if (startWord === -1)
+ startWord = i;
+ }
+ if (startWord !== -1)
+ words.push(text.substring(startWord));
+ return words;
+ },
}
WebInspector.TextUtils._SpaceCharRegex = /\s/;
« no previous file with comments | « Source/devtools/front_end/Settings.js ('k') | Source/devtools/front_end/UISourceCodeFrame.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698