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

Side by Side 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, 6 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
« no previous file with comments | « Source/devtools/front_end/Settings.js ('k') | Source/devtools/front_end/UISourceCodeFrame.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 return char === ")" || char === "}"; 91 return char === ")" || char === "}";
92 }, 92 },
93 93
94 /** 94 /**
95 * @param {string} char 95 * @param {string} char
96 * @return {boolean} 96 * @return {boolean}
97 */ 97 */
98 isBraceChar: function(char) 98 isBraceChar: function(char)
99 { 99 {
100 return WebInspector.TextUtils.isOpeningBraceChar(char) || WebInspector.T extUtils.isClosingBraceChar(char); 100 return WebInspector.TextUtils.isOpeningBraceChar(char) || WebInspector.T extUtils.isClosingBraceChar(char);
101 } 101 },
102
103 textToWords: function(text)
104 {
105 var words = [];
106 var startWord = -1;
107 for(var i = 0; i < text.length; ++i) {
108 if (!WebInspector.TextUtils.isWordChar(text.charAt(i))) {
109 if (startWord !== -1)
110 words.push(text.substring(startWord, i));
111 startWord = -1;
112 } else if (startWord === -1)
113 startWord = i;
114 }
115 if (startWord !== -1)
116 words.push(text.substring(startWord));
117 return words;
118 },
102 } 119 }
103 120
104 WebInspector.TextUtils._SpaceCharRegex = /\s/; 121 WebInspector.TextUtils._SpaceCharRegex = /\s/;
105 122
106 /** 123 /**
107 * @enum {string} 124 * @enum {string}
108 */ 125 */
109 WebInspector.TextUtils.Indent = { 126 WebInspector.TextUtils.Indent = {
110 TwoSpaces: " ", 127 TwoSpaces: " ",
111 FourSpaces: " ", 128 FourSpaces: " ",
112 EightSpaces: " ", 129 EightSpaces: " ",
113 TabCharacter: "\t" 130 TabCharacter: "\t"
114 } 131 }
OLDNEW
« 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