10
10
11
11
A Fortran implementation of the [ Language Server
12
12
Protocol] ( https://github.com/Microsoft/language-server-protocol ) using
13
- Python (2.7+ or 3.0 +).
13
+ Python (3.6 +).
14
14
15
15
Editor extensions using this language server to provide autocomplete and
16
16
other IDE-like functionality are available for
@@ -56,16 +56,9 @@ and [Emacs](https://github.com/emacs-lsp/lsp-mode).
56
56
57
57
## Installation
58
58
59
- ` pip install fortran-language-server `
60
-
61
- If you get the following error:
62
-
63
- > ` 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers `
64
-
65
- try updating setuptools:
66
-
67
- pip install -U setuptools
68
- pip install fortran-language-server
59
+ ``` sh
60
+ pip install fortls
61
+ ```
69
62
70
63
## Language server settings
71
64
@@ -157,36 +150,47 @@ Project specific settings can be specified by placing a JSON file named
157
150
- ` max_comment_line_length ` Maximum comment line length (default:
158
151
none)
159
152
160
- ### Setup source file search paths
153
+ ## Additional settings
154
+
155
+ ### Default file extensions
161
156
162
157
By default all files with the suffix ` F,F77,F90,F95,F03,F08,FOR,FPP `
163
158
(case-insensitive) in the ` root_dir ` directory, specified during
164
159
initialization, and all its sub-directories are parsed and included in
165
160
the project.
166
161
162
+ ### Excluding folders and file extensions
163
+
167
164
Directories and files can be excluded from the project by specifying
168
- their paths (relative to ` root_dir ` ) in the ` excl_paths ` variable in the
169
- ` .fortls ` file. Excluded directories also exclude all sub-directories.
165
+ their paths in the ` excl_paths ` variable in the` .fortls ` file.
166
+ Paths can be absolute or relative to ` root_dir ` .
167
+
168
+ Excluded directories ** will not** exclude all sub-directories.
170
169
Source files with a common suffix may also be excluded using the
171
170
` excl_suffixes ` variable.
172
171
172
+ > NOTE: All directory inputs fields (` excl_paths ` , ` source_dirs ` , ` include_dirs ` ) support
173
+ > [ Python glob patterns] ( https://docs.python.org/3/library/glob.html ) e.g. ` /** ` , ` * ` , etc.
174
+
175
+ ### Including source directories
176
+
177
+ By default all source directories under ` root_dir ` are recursively included.
173
178
Source file directories can also be specified manually by specifying
174
- their paths (relative to ` root_dir ` ) in the ` source_dirs ` variable in
175
- the ` .fortls ` file. When ` source_dirs ` is specified directories are not
176
- added recursively, so any nested sub directories must be explicitly
177
- listed. However, ` root_dir ` does not need to be specified manually as it
178
- is always included.
179
-
180
- External source files (ex. libraries) can also be included in language
181
- server results by specifying their paths in the ` ext_source_dirs `
182
- variable in the ` .fortls ` file. These files will be parsed during
183
- initialization, but will not be updated with any changes made until the
184
- language server is restarted. As with ` source_dirs ` , specified
185
- directories are not added recursively, so any nested sub directories
186
- must be explicitly listed.
187
-
188
- ** Note:** The previous naming convention for source file directories
189
- (` mod_dirs ` ) is still supported but has been deprecated.
179
+ their paths in the ` source_dirs ` variable in ` .fortls ` .
180
+ Paths can be absolute or relative to ` root_dir ` .
181
+ the ` .fortls ` file.
182
+
183
+ When defining ` source_dirs ` in ` .fortls ` the default behaviour (i.e. including
184
+ all files in all subdirectories under ` root_dir ` ) is overriden. To include them
185
+ back again one can do
186
+
187
+ ``` json
188
+ {
189
+ "source_dirs" : [" /**" , " all" , " other" , " dirs" ]
190
+ }
191
+ ```
192
+
193
+ > NOTE: ` root_dir ` does not need to be specified manually as it is always included.
190
194
191
195
### Preprocessing
192
196
@@ -205,7 +209,7 @@ File suffixes for preprocessing can be controlled with the variable
205
209
used _ only_ those files with the specified suffixes will be
206
210
preprocessed. If an empty array is specified then _ no_ preprocessing
207
211
will be performed on any files. By default, or if the variable is
208
- ommited or ` null ` , only files with upper case suffixes are preprocessed.
212
+ omitted or ` null ` , only files with upper case suffixes are preprocessed.
209
213
210
214
Preprocessor definitions can be set for each project, to improve support
211
215
for Fortran files using conditional compilation, using the ` pp_defs `
@@ -226,17 +230,18 @@ File search is performed starting with the containing directory followed
226
230
by the specified ` include_dirs ` specified paths, in order (left to
227
231
right).
228
232
229
- {
230
- "source_dirs": ["subdir1", "subdir2"],
231
- "excl_paths": ["subdir3", "subdir1/file_to_skip.F90"],
232
- "excl_suffixes": ["_skip.f90"],
233
- "pp_suffixes": [".f03", ".F90"],
234
- "pp_defs": {"HAVE_PACKAGE": ""},
235
- "include_dirs": ["rel_include/dir_path", "/abs/include/dir/path"],
236
- "ext_source_dirs": ["/path/to/fortran/library"],
237
- "lowercase_intrinsics": false,
238
- "debug_log": false
239
- }
233
+ ``` json
234
+ {
235
+ "source_dirs" : [" subdir1/**" , " subdir2" ],
236
+ "excl_paths" : [" subdir3/**" , " subdir1/file_to_skip.F90" ],
237
+ "excl_suffixes" : [" _skip.f90" ],
238
+ "pp_suffixes" : [" .f03" , " .F90" ],
239
+ "pp_defs" : { "HAVE_PACKAGE" : " " },
240
+ "include_dirs" : [" rel_include/dir_path" , " /abs/include/dir/path" ],
241
+ "lowercase_intrinsics" : false ,
242
+ "debug_log" : false
243
+ }
244
+ ```
240
245
241
246
## Bug reports
242
247
0 commit comments