[cm6] Configure "4 spaces" as the indent unit for all files (#14366)

GitOrigin-RevId: 5aed6bc5abfd194c11830bdedcbba65ef1ed0522
This commit is contained in:
Alf Eaton 2023-08-17 11:01:10 +01:00 committed by Copybot
parent 2d15ce8d05
commit fbb0ab210e
3 changed files with 5 additions and 7 deletions

View file

@ -7,7 +7,7 @@ import {
highlightActiveLineGutter,
} from '@codemirror/view'
import { EditorState, Extension } from '@codemirror/state'
import { foldGutter, indentOnInput } from '@codemirror/language'
import { foldGutter, indentOnInput, indentUnit } from '@codemirror/language'
import { history } from '@codemirror/commands'
import { language } from './language'
import { lineWrappingIndentation } from './line-wrapping-indentation'
@ -107,6 +107,7 @@ export const createExtensions = (options: Record<string, any>): Extension[] => [
// NOTE: `annotations` needs to be before `language`
annotations(),
language(options.currentDoc, options.metadata, options.settings),
indentUnit.of(' '), // 4 spaces
theme(options.theme),
realtime(options.currentDoc, options.handleError),
cursorPosition(options.currentDoc),

View file

@ -1,8 +1,6 @@
import { LanguageSupport, indentUnit } from '@codemirror/language'
import { LanguageSupport } from '@codemirror/language'
import { BibTeXLanguage } from './bibtex-language'
export const bibtex = () => {
return new LanguageSupport(BibTeXLanguage, [
indentUnit.of(' '), // 4 spaces
])
return new LanguageSupport(BibTeXLanguage)
}

View file

@ -1,7 +1,7 @@
import { latexIndentService } from './latex-indent-service'
import { shortcuts } from './shortcuts'
import { linting } from './linting'
import { LanguageSupport, indentUnit } from '@codemirror/language'
import { LanguageSupport } from '@codemirror/language'
import { CompletionSource } from '@codemirror/autocomplete'
import { openAutocomplete } from './open-autocomplete'
import { metadata } from './metadata'
@ -30,7 +30,6 @@ const completionSources: CompletionSource[] = [
export const latex = () => {
return new LanguageSupport(LaTeXLanguage, [
indentUnit.of(' '), // 4 spaces
shortcuts(),
documentOutline.extension,
documentCommands.extension,