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

Method SetFileExt

texteditor/text/lines.go:172–182  ·  view source on GitHub ↗

SetFileExt sets syntax highlighting and other parameters based on the given file extension (without the . prefix), for cases where an actual file with fileinfo.FileInfo is not available.

(ext string)

Source from the content-addressed store, hash-verified

170// for cases where an actual file with fileinfo.FileInfo is not
171// available.
172func (ls *Lines) SetFileExt(ext string) {
173 if len(ext) == 0 {
174 return
175 }
176 if ext[0] == '.' {
177 ext = ext[1:]
178 }
179 fn := "_fake." + strings.ToLower(ext)
180 fi, _ := fileinfo.NewFileInfo(fn)
181 ls.SetFileInfo(fi)
182}
183
184// SetHighlighting sets the highlighting style.
185func (ls *Lines) SetHighlighting(style core.HighlightingName) {

Callers

nothing calls this directly

Calls 2

SetFileInfoMethod · 0.95
NewFileInfoFunction · 0.92

Tested by

no test coverage detected