1010
1111A Fortran implementation of the [ Language Server
1212Protocol] ( https://github.com/Microsoft/language-server-protocol ) using
13- Python (2.7+ or 3.0 +).
13+ Python (3.6 +).
1414
1515Editor extensions using this language server to provide autocomplete and
1616other IDE-like functionality are available for
@@ -56,16 +56,9 @@ and [Emacs](https://github.com/emacs-lsp/lsp-mode).
5656
5757## Installation
5858
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+ ```
6962
7063## Language server settings
7164
@@ -157,36 +150,47 @@ Project specific settings can be specified by placing a JSON file named
157150- ` max_comment_line_length ` Maximum comment line length (default:
158151 none)
159152
160- ### Setup source file search paths
153+ ## Additional settings
154+
155+ ### Default file extensions
161156
162157By default all files with the suffix ` F,F77,F90,F95,F03,F08,FOR,FPP `
163158(case-insensitive) in the ` root_dir ` directory, specified during
164159initialization, and all its sub-directories are parsed and included in
165160the project.
166161
162+ ### Excluding folders and file extensions
163+
167164Directories 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.
170169Source files with a common suffix may also be excluded using the
171170` excl_suffixes ` variable.
172171
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.
173178Source 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.
190194
191195### Preprocessing
192196
@@ -205,7 +209,7 @@ File suffixes for preprocessing can be controlled with the variable
205209used _ only_ those files with the specified suffixes will be
206210preprocessed. If an empty array is specified then _ no_ preprocessing
207211will 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.
209213
210214Preprocessor definitions can be set for each project, to improve support
211215for Fortran files using conditional compilation, using the ` pp_defs `
@@ -226,17 +230,18 @@ File search is performed starting with the containing directory followed
226230by the specified ` include_dirs ` specified paths, in order (left to
227231right).
228232
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+ ```
240245
241246## Bug reports
242247
0 commit comments