summaryrefslogtreecommitdiff
path: root/doc/ale-cs.txt
blob: 26e2b023a04b9fc37145bf18f1eea15f4c38fa3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
===============================================================================
ALE C# Integration                                             *ale-cs-options*


In addition to the linters that are provided with ALE, C# code can be checked
with the OmniSharp plugin. See here: https://github.com/OmniSharp/omnisharp-vim


===============================================================================
csc                                                                *ale-cs-csc*

  The |ale-cs-csc| linter checks for semantic errors when files are opened or
  saved.

  See |ale-lint-file-linters| for more information on linters which do not
  check for problems while you type.

  The csc linter uses the mono csc compiler, providing full C# 7 and newer
  support, to generate a temporary module target file (/t:module). The module
  includes all '*.cs' files contained in the directory tree rooted at the path
  defined by the |g:ale_cs_csc_source| or |b:ale_cs_csc_source| variable and
  all sub directories.

  It will in future replace the |ale-cs-mcs| and |ale-cs-mcsc| linters as both
  utilize the mcsc compiler which, according to the mono project, is no longer
  actively developed, and only receives maintenance updates. However, because
  the csc compiler does not support the -syntax option, this linter does not
  offer any as-you-type syntax checking, similar to the |ale-cs-mcsc| linter.

  The paths to search for additional assembly files can be specified using the
  |g:ale_cs_csc_assembly_path| or |b:ale_cs_csc_assembly_path| variables.

  NOTE: ALE will not find any errors in files apart from syntax errors if any
  one of the source files contains a syntax error. Syntax errors must be fixed
  first before other errors will be shown.


g:ale_cs_csc_options                                     *g:ale_cs_csc_options*
                                                         *b:ale_cs_csc_options*
  Type: |String|
  Default: `''`

  This option can be set to pass additional arguments to the `csc` compiler.

  For example, to add the dotnet package which is not added per default: >

      let g:ale_cs_mcs_options = ' /warn:4 /langversion:7.2'
<
  NOTE: the `/unsafe` option is always passed to `csc`.


g:ale_cs_csc_source                                       *g:ale_cs_csc_source*
                                                          *b:ale_cs_csc_source*
  Type: |String|
  Default: `''`

  This variable defines the root path of the directory tree searched for the
  '*.cs' files to be linted. If this option is empty, the source file's
  directory will be used.

  NOTE: Currently it is not possible to specify sub directories and
  directory sub trees which shall not be searched for *.cs files.


g:ale_cs_csc_assembly_path                         *g:ale_cs_csc_assembly_path*
                                                   *b:ale_cs_csc_assembly_path*
  Type: |List|
  Default: `[]`

  This variable defines a list of path strings to be searched for external
  assembly files. The list is passed to the csc compiler using the `/lib:`
  flag.


g:ale_cs_csc_assemblies                               *g:ale_cs_csc_assemblies*
                                                      *b:ale_cs_csc_assemblies*
  Type: |List|
  Default: `[]`

  This variable defines a list of external assembly (*.dll) files required
  by the mono mcs compiler to generate a valid module target. The list is
  passed the csc compiler using the `/r:` flag.

  For example: >

    " Compile C# programs with the Unity engine DLL file on Mac.
    let g:ale_cs_mcsc_assemblies = [
    \ '/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll',
    \ 'path-to-unityproject/obj/Debug',
    \]
<

===============================================================================
cspell                                                          *ale-cs-cspell*

See |ale-cspell-options|


===============================================================================
dotnet-format                                            *ale-cs-dotnet-format*

Installation
-------------------------------------------------------------------------------

Installing .NET SDK should probably ensure that `dotnet` is in your `$PATH`.
For .NET 6 the `dotnet format` tool is already included in the .NET SDK. For
.NET 5 or below you will have to manually install it using the instructions
from listed in this repository: https://github.com/dotnet/format


Options
-------------------------------------------------------------------------------

g:ale_cs_dotnet_format_executable           *g:ale_cs_dotnet_format_executable*
                                            *b:ale_cs_dotnet_format_executable*
  Type: |String|
  Default: `'dotnet'`

  This variable can be set to specify an absolute path to the
  `dotnet` executable (or to specify an alternate executable).


g:ale_cs_dotnet_format_options                 *g:ale_cs_dotnet_format_options*
                                               *b:ale_cs_dotnet_format_options*
  Type: |String|
  Default: `''`

  This variable can be set to pass additional options to the `dotnet format`
  fixer.


===============================================================================
mcs                                                                *ale-cs-mcs*

  The `mcs` linter looks only for syntax errors while you type. See
  |ale-cs-mcsc| for the separately configured linter for checking for semantic
   errors.


g:ale_cs_mcs_options                                     *g:ale_cs_mcs_options*
                                                         *b:ale_cs_mcs_options*

  Type: String
  Default: `''`

  This variable can be changed to pass additional flags given to mcs.

  NOTE: The -unsafe flag is selected implicitly and thus does not need to be
  explicitly included in the |g:ale_cs_mcs_options| or |b:ale_cs_mcs_options|
  parameter.


===============================================================================
mcsc                                                              *ale-cs-mcsc*

  The mcsc linter checks for semantic errors when files are opened or saved
  See |ale-lint-file-linters| for more information on linters which do not
  check for problems while you type.

  The mcsc linter uses the mono mcs compiler to generate a temporary module
  target file (-t:module). The module includes including all '*.cs' files
  contained in the directory tree rooted at the path defined by the
  |g:ale_cs_mcsc_source| or |b:ale_cs_mcsc_source| variable.
  variable and all sub directories.

  The paths to search for additional assembly files can be specified using the
  |g:ale_cs_mcsc_assembly_path| or |b:ale_cs_mcsc_assembly_path| variables.

  NOTE: ALE will not find any errors in files apart from syntax errors if any
  one of the source files contains a syntax error. Syntax errors must be fixed
  first before other errors will be shown.


g:ale_cs_mcsc_options                                   *g:ale_cs_mcsc_options*
                                                        *b:ale_cs_mcsc_options*
  Type: |String|
  Default: `''`

  This option can be set to pass additional arguments to the `mcs` compiler.

  For example, to add the dotnet package which is not added per default: >

      let g:ale_cs_mcs_options = '-pkg:dotnet'
<
  NOTE: the `-unsafe` option is always passed to `mcs`.


g:ale_cs_mcsc_source                                     *g:ale_cs_mcsc_source*
                                                         *b:ale_cs_mcsc_source*
  Type: |String|
  Default: `''`

  This variable defines the root path of the directory tree searched for the
  '*.cs' files to be linted. If this option is empty, the source file's
  directory will be used.

  NOTE: Currently it is not possible to specify sub directories and
  directory sub trees which shall not be searched for *.cs files.


g:ale_cs_mcsc_assembly_path                       *g:ale_cs_mcsc_assembly_path*
                                                  *b:ale_cs_mcsc_assembly_path*
  Type: |List|
  Default: `[]`

  This variable defines a list of path strings to be searched for external
  assembly files. The list is passed to the mcs compiler using the `-lib:`
  flag.


g:ale_cs_mcsc_assemblies                             *g:ale_cs_mcsc_assemblies*
                                                     *b:ale_cs_mcsc_assemblies*
  Type: |List|
  Default: `[]`

  This variable defines a list of external assembly (*.dll) files required
  by the mono mcs compiler to generate a valid module target. The list is
  passed the mcs compiler using the `-r:` flag.

  For example: >

    " Compile C# programs with the Unity engine DLL file on Mac.
    let g:ale_cs_mcsc_assemblies = [
    \ '/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll',
    \ 'path-to-unityproject/obj/Debug',
    \]
<

===============================================================================
uncrustify                                                  *ale-cs-uncrustify*

See |ale-c-uncrustify| for information about the available options.


===============================================================================
  vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: