MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / indent

Function indent

static/js/codemirror/mode/python/python.js:191–212  ·  view source on GitHub ↗
(stream, state, type)

Source from the content-addressed store, hash-verified

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

Callers 1

tokenLexerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected