Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
config:crystal [2018/07/28 18:33] – created to answer https://github.com/geany/geany/issues/1714 colombanwconfig:crystal [2021/01/27 23:01] (current) – Add Deque j8r
Line 1: Line 1:
 ====== Crystal filetype ====== ====== Crystal filetype ======
-Experimental [[http://www.geany.org/manual/#custom-filetypes|custom filetype]] for the [[https://crystal-lang.org/|Crystal]] language.+Experimental [[http://www.geany.org/manual/#custom-filetypes|custom filetype]] for the [[https://crystal-lang.org/|Crystal]] language. See also the [[https://github.com/crystal-lang-tools/geany-crystal|geany-crystal]] Git project. 
 + 
 +Crystal isn't supported directly, so another close language has to be chosen instead. We have the choice of either Ruby or CoffeeScript, which both have their pros/cons. 
 + 
 +=== CoffeeScript === 
 + 
 +This configuration is taken from the Git project (which might have a more up-to-date one), and use the CoffeeScript lexer. 
 + 
 +It generally supports more syntax highlighting than the Ruby lexer (see the next section). 
 + 
 +<file properties ~/.config/geany/filedefs/filetypes.Crystal.conf> 
 +# For complete documentation of this file, please see Geany's main documentation 
 +[styling=CoffeeScript] 
 + 
 +[keywords] 
 +# all items must be in one line 
 +primary=__FILE__ __LINE__ __DIR__ ARGV macro do extend getter setter property class_setter class_getter class_property pointerof sizeof typeof def fun end in out unless begin ensure module super until break do false next rescue then when case else for include require true while loop alias class record struct enum elsif if not return yield nil 
 +secondary=abstract abort exit self initialize finalize private protected p pp print puts raise new is_a to_a to_f to_f32 to_f64 to_h to_i to_i8 to_i16 to_i32 to_i64 to_i128 to_u to_u8 to_u16 to_u32 to_u64 to_u128 to_s to_unsafe first last shift pop starts_with ends_with empty each as 
 +# types, classes  
 +globalclass=Any Array ArrayLiteral Bool BoolLiteral Bytes Char Deque Enumerable Float32 Float64 Hash Indexable Int8 Int16 Int32 Int64 Int128 NamedTuple NamedTupleLiteral Nil NilLiteral NumberLiteral Path Pointer Proc Regex RegexLiteral Set Slice StaticArray String StringLiteral Symbol SymbolLiteral Tuple TupleLiteral UInt8 UInt16 UInt32 UInt64 UInt128 
 + 
 +[settings] 
 +lexer_filetype=CoffeeScript 
 +tag_parser=Ruby 
 + 
 +# default extension used when saving files 
 +extension=cr 
 + 
 +# MIME type 
 +mime_type=text/x-crystal 
 + 
 +# single comments, like # in this file 
 +comment_single=# 
 + 
 +# This setting works only for single line comments 
 +comment_use_indent=true 
 + 
 +# context action command (please see Geany's main documentation for details) 
 +context_action_cmd=sensible-browser "https://crystal-lang.org/api/latest/%s.html" 
 + 
 +[indentation] 
 +width=2 
 +# 0 is spaces, 1 is tabs, 2 is tab & spaces 
 +type=0 
 + 
 +[build-menu] 
 +# %f will be replaced by the complete filename 
 +# %e will be replaced by the filename without extension 
 +# (use only one of it at one time) 
 +FT_00_LB=_Build 
 +FT_00_CM=crystal build --no-color %f 
 +FT_00_WD= 
 +FT_01_LB=_Format 
 +FT_01_CM=crystal tool format --no-color %f 
 +FT_01_WD= 
 +# Run is the same as build + execute 
 +EX_00_LB=_Run 
 +EX_00_CM=crystal run %f 
 +EX_00_WD= 
 +</file> 
 + 
 +=== Ruby === 
 + 
 +Another configuration is to use the Ruby lexer. It is kept here, since some may prefer.
  
 <file properties ~/.config/geany/filedefs/filetypes.Crystal.conf> <file properties ~/.config/geany/filedefs/filetypes.Crystal.conf>
Line 28: Line 91:
 </file> </file>
  
-And alter your //filetype_extensions.conf// to add the new Crystal filetype.+====== Crystal file extensions recognition ====== 
 + 
 +Alter your //filetype_extensions.conf// to add the new Crystal filetype.
 <file properties ~/.config/geany/filetype_extensions.conf> <file properties ~/.config/geany/filetype_extensions.conf>
 [Extensions] [Extensions]
 ... ...
-Crystal=*.cr;+Crystal=*.cr,*.ecr;
 ... ...
  
 [Groups] [Groups]
 ... ...
-Script=Crystal;+Programming=Crystal;
 ... ...
 </file> </file>
  
 {{tag>configure crystal filetype}} {{tag>configure crystal filetype}}
Print/export