MCPcopy Create free account
hub / github.com/cogentcore/core / SetFileInfo

Method SetFileInfo

texteditor/text/lines.go:149–160  ·  view source on GitHub ↗

SetFileInfo sets the syntax highlighting and other parameters based on the type of file specified by given fileinfo.FileInfo.

(info *fileinfo.FileInfo)

Source from the content-addressed store, hash-verified

147// SetFileInfo sets the syntax highlighting and other parameters
148// based on the type of file specified by given fileinfo.FileInfo.
149func (ls *Lines) SetFileInfo(info *fileinfo.FileInfo) {
150 ls.Lock()
151 defer ls.Unlock()
152
153 ls.ParseState.SetSrc(string(info.Path), "", info.Known)
154 ls.Highlighter.Init(info, &ls.ParseState)
155 ls.Options.ConfigKnown(info.Known)
156 if ls.numLines() > 0 {
157 ls.initialMarkup()
158 ls.startDelayedReMarkup()
159 }
160}
161
162// SetFileType sets the syntax highlighting and other parameters
163// based on the given fileinfo.Known file type

Callers 3

SetLanguageMethod · 0.95
SetFileExtMethod · 0.95
SetFilenameMethod · 0.80

Calls 8

numLinesMethod · 0.95
initialMarkupMethod · 0.95
startDelayedReMarkupMethod · 0.95
LockMethod · 0.65
UnlockMethod · 0.65
InitMethod · 0.65
SetSrcMethod · 0.45
ConfigKnownMethod · 0.45

Tested by

no test coverage detected