gtksourceview2- Binding to the GtkSourceView library.
Portabilityportable (depends on GHC)
Safe HaskellNone







SourceLanguageManager is an object which processes language description files and creates and stores SourceLanguage objects, and provides API to access them. Use sourceLanguageManagerGetDefault to retrieve the default instance of SourceLanguageManager, and sourceLanguageManagerGuessLanguage to get a SourceLanguage for given file name and content type.



sourceLanguageManagerNew :: IO SourceLanguageManager Source #

Creates a new language manager. If you do not need more than one language manager or a private language manager instance then use sourceLanguageManagerGetDefault instead.

sourceLanguageManagerSetSearchPath :: (SourceLanguageManagerClass slm, GlibFilePath fp) => slm -> Maybe [fp] -> IO () Source #

Sets the list of directories where the lm looks for language files. If dirs is Nothing, the search path is reset to default.


At the moment this function can be called only before the language files are loaded for the first time. In practice to set a custom search path for a SourceLanguageManager, you have to call this function right after creating it.

sourceLanguageManagerGetSearchPath :: (SourceLanguageManagerClass slm, GlibFilePath fp) => slm -> IO [fp] Source #

Gets the list directories where lm looks for language files.

sourceLanguageManagerGetLanguageIds :: (SourceLanguageManagerClass slm, GlibString string) => slm -> IO [string] Source #

Returns the ids of the available languages.

sourceLanguageManagerGetLanguage Source #


:: (SourceLanguageManagerClass slm, GlibString string) 
=> slm 
-> string

id a language id.

-> IO (Maybe SourceLanguage)

returns a SourceLanguage, or Nothing if there is no language identified by the given id.

Gets the SourceLanguage identified by the given id in the language manager.

sourceLanguageManagerGuessLanguage Source #


:: (SourceLanguageManagerClass slm, GlibFilePath fp, GlibString string) 
=> slm 
-> Maybe fp

filename a filename in Glib filename encoding, or Nothing.

-> Maybe string

contentType a content type (as in GIO API), or Nothing.

-> IO (Maybe SourceLanguage)

returns a SourceLanguage, or Nothing if there is no suitable language for given filename and/or contentType.

Picks a SourceLanguage for given file name and content type, according to the information in lang files. Either filename or contentType may be Nothing.


sourceLanguageManagerLanguageIds :: (SourceLanguageManagerClass slm, GlibString string) => ReadAttr slm [string] Source #

List of the ids of the available languages.

sourceLanguageManagerSearchPath :: (SourceLanguageManagerClass slm, GlibString string) => ReadWriteAttr slm [string] (Maybe [string]) Source #

List of directories where the language specification files (.lang) are located.