MCPcopy Create free account
hub / github.com/nwutils/nw-sample-apps / indent

Function indent

mini-code-edit/cm/mode/python/python.js:189–210  ·  view source on GitHub ↗
(stream, state, type)

Source from the content-addressed store, hash-verified

187 }
188
189 function indent(stream, state, type) {
190 type = type || 'py';
191 var indentUnit = 0;
192 if (type === 'py') {
193 if (state.scopes[0].type !== 'py') {
194 state.scopes[0].offset = stream.indentation();
195 return;
196 }
197 for (var i = 0; i < state.scopes.length; ++i) {
198 if (state.scopes[i].type === 'py') {
199 indentUnit = state.scopes[i].offset + conf.indentUnit;
200 break;
201 }
202 }
203 } else {
204 indentUnit = stream.column() + stream.current().length;
205 }
206 state.scopes.unshift({
207 offset: indentUnit,
208 type: type
209 });
210 }
211
212 function dedent(stream, state, type) {
213 type = type || 'py';

Callers 1

tokenLexerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected