1.. _ctags-lang-julia(7): 2 3============================================================== 4ctags-lang-julia 5============================================================== 6 7Random notes about tagging Julia source code with Universal-ctags 8 9:Version: 5.9.0 10:Manual group: Universal-ctags 11:Manual section: 7 12 13SYNOPSIS 14-------- 15| **ctags** ... --languages=+Julia ... 16| **ctags** ... --language-force=Julia ... 17| **ctags** ... --map-Julia=+.jl ... 18 19DESCRIPTION 20----------- 21This man page gathers random notes about tagging Julia source code. 22 23TAGGING ``import`` AND ``using`` EXPRESSIONS 24-------------------------------------------- 25 26Summary 27~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 28 29`using X` 30 31 ==== ========== ================== =================== 32 name kind role other noticeable fields 33 ==== ========== ================== =================== 34 X module used N/A 35 ==== ========== ================== =================== 36 37`using X: a, b` 38 39 ==== ========== ================== =================== 40 name kind role other noticeable fields 41 ==== ========== ================== =================== 42 X module namespace N/A 43 a, b unknown used scope:module:X 44 ==== ========== ================== =================== 45 46`import X` 47 48 ==== ========== ================== =================== 49 name kind role other noticeable fields 50 ==== ========== ================== =================== 51 X module imported N/A 52 ==== ========== ================== =================== 53 54`import X.a, Y.b` 55 56 ==== ========== ================== =================== 57 name kind role other noticeable fields 58 ==== ========== ================== =================== 59 X, Y module namespace N/A 60 a unknown imported scope:module:X 61 b unknown imported scope:module:Y 62 ==== ========== ================== =================== 63 64`import X: a, b` 65 66 ==== ========== ================== =================== 67 name kind role other noticeable fields 68 ==== ========== ================== =================== 69 X module namespace N/A 70 a,b unknown imported scope:module:X 71 ==== ========== ================== =================== 72 73Examples 74~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75"input.jl" 76 77.. code-block:: Julia 78 79 using X0 80 81"output.tags" 82with "--options=NONE -o - --extras=+r --fields=+rzK input.jl" 83 84.. code-block:: tags 85 86 X0 input.jl /^using X0$/;" kind:module roles:used 87 88``--extras=+r`` (or ``--extras=+{reference}``) option is needed for this tag, 89since it's a reference tag. This is because module ``X`` is not defined here. 90It is defined in another file. Enable ``roles:`` field with ``--fields=+r`` is 91for recording that the module is "used", i.e., loaded by ``using``. 92 93"input.jl" 94 95.. code-block:: Julia 96 97 import X1.a, X2.b, X3 98 99"output.tags" 100with "--options=NONE -o - --extras=+r --fields=+rzKZ input.jl" 101 102.. code-block:: tags 103 104 X1 input.jl /^import X1.a, X2.b, X3$/;" kind:module roles:namespace 105 X2 input.jl /^import X1.a, X2.b, X3$/;" kind:module roles:namespace 106 X3 input.jl /^import X1.a, X2.b, X3$/;" kind:module roles:imported 107 a input.jl /^import X1.a, X2.b, X3$/;" kind:unknown scope:module:X1 roles:imported 108 b input.jl /^import X1.a, X2.b, X3$/;" kind:unknown scope:module:X2 roles:imported 109 110Why ``X1`` and ``X2`` have role "namespace", while ``X3`` have role "imported"? 111It's because the symbol ``a`` in module ``X1``, and ``b`` in module ``X2`` are 112brought to the current scope, but ``X1`` and ``X2`` themselves are not. We use 113"namespace" role for such modules. 114 115``X3`` is different. The symbol ``X3``, together with all exported symbols in 116``X3``, is brought to current scope. For such modules, we use "imported" or 117"used" role depending whether they are loaded by ``import`` or ``using``. 118 119Also, notice that ``a`` and ``b`` have the "unknown" kind. This is because we 120cannot know whether it's a function, constant, or macro, etc. 121 122SEE ALSO 123-------- 124:ref:`ctags(1) <ctags(1)>`, :ref:`ctags-client-tools(7) <ctags-client-tools(7)>` 125