J'utilise ScintillaNET comme un wrapper pour le contrôle Scintilla Je veux changer les mots-clés (pour la coloration syntaxique) pour une langue spécifique, je suppose que je dois construire ma propre version de SciLexer.dll pour Mais je ne trouve pas de fichier de mots-clés pour les langues du projet Scintilla Où sont-elles et comment puis-je les changer?Ajouter des mots-clés avec Scintilla
4
A
Répondre
8
Vous n'avez pas besoin de créer votre propre SciLexer.dll, ScintillaNET prend en charge la configuration XML . fichiers Définissez les propriétés du Scintilla comme ceci:
// Relative to your running directory
scintilla1.ConfigurationManager.CustomLocation = "Config.xml";
//Name of the language as defined in the file
scintilla1.ConfigurationManager.Language = "MyLanguage";
Ensuite, créez un fichier de configuration comme celui-ci, qui est basé sur Lua:
<?xml version="1.0" encoding="utf-8"?>
<ScintillaNET>
<!--This is what you set the Language property to-->
<Language Name="lua">
<!--These are characters after which autocomplete will open-->
<AutoComplete FillUpCharacters=".([" SingleLineAccept="True" IsCaseSensitive="False">
<List>
<!--Insert autocomplete keywords here-->
and break do else elseif end false for function
if in local nil not or repeat return then true until while
</List>
</AutoComplete>
<!--Indentation width and indentation type-->
<Indentation TabWidth="4" SmartIndentType="cpp" />
<!--Comment characters and the lexer to use-->
<Lexer LexerName="lua" LineCommentPrefix="--" StreamCommentPrefix="--[[ " StreamCommentSuffix=" ]]" >
<Keywords List="0" Inherit="False">
<!--Insert highlighted keywords here-->
and break do else elseif end false for function
if in local nil not or repeat return then true until while
</Keywords>
</Lexer>
</Language>
</ScintillaNET>
Impressionnant. Merci :) – david