Skip to content

Commit a35b684

Browse files
authored
Merge pull request #88 from JHenneberg/feature/He/extendKeywords
extended list of keywords
2 parents 008e47c + 91dde5b commit a35b684

File tree

5 files changed

+112
-28
lines changed

5 files changed

+112
-28
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# CHANGELONG
22

3+
## 2.2.11
4+
5+
### Added
6+
7+
- Improved autocompletion for Fortran statements F2018 compliant
8+
([#63](https://github.com/gnikit/fortls/issues/63))
9+
310
## 2.2.10
411

512
### Fixed

fortls/intrinsics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def add_children(json_obj, fort_obj):
137137
add_children(child, child_obj)
138138

139139
# Fortran statments taken from Intel Fortran documentation
140-
# (https://software.intel.com/en-us/fortran-compiler-18.0-developer-guide)
140+
# (https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/language-reference/a-to-z-reference)
141141
json_file = os.path.join(
142142
os.path.dirname(os.path.abspath(__file__)), "statements.json"
143143
)
@@ -148,7 +148,7 @@ def add_children(json_obj, fort_obj):
148148
for name, json_obj in sorted(intrin_file[key].items()):
149149
statements[key].append(create_int_object(name, json_obj, 15))
150150
# Fortran keywords taken from Intel Fortran documentation
151-
# (https://software.intel.com/en-us/fortran-compiler-18.0-developer-guide)
151+
# (https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/language-reference/a-to-z-reference)
152152
json_file = os.path.join(
153153
os.path.dirname(os.path.abspath(__file__)), "keywords.json"
154154
)

fortls/keywords.json

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,74 @@
11
{
22
"var_def": {
33
"ALLOCATABLE": {
4-
"doc": "Specify that an array is an allocatable array with a deferred shape."
4+
"doc": "Specifies that an object is allocatable."
55
},
66
"ASYNCHRONOUS": {
7-
"doc": "Specify that a variable can be used for asynchronous input and output."
7+
"doc": "Specifies that a variable can be used for asynchronous input and output."
8+
},
9+
"BIND": {
10+
"doc": "Specifies that an object is interoperable with C and has external linkage."
11+
},
12+
"CODIMENSION": {
13+
"doc": "Specifies that an entity is a coarray, and specifies its corank and cobounds, if any."
814
},
915
"CONTIGUOUS": {
10-
"doc": "Specify that the target of a pointer or an assumed-sized array is contiguous."
16+
"doc": "Specifies that the target of a pointer or an assumed-sized array is contiguous."
1117
},
1218
"DIMENSION(:)": {
13-
"doc": "Specify that an object is an array, and defines the shape of the array."
19+
"doc": "Specifies that an object is an array, and defines the shape of the array."
20+
},
21+
"EXTERNAL": {
22+
"doc": "Allows an external procedure, a dummy procedure, a procedure pointer, or a block data subprogram to be used as an actual argument."
23+
},
24+
"INTRINSIC": {
25+
"doc": "Allows the specific name of an intrinsic procedure to be used as an actual argument."
1426
},
1527
"POINTER": {
16-
"doc": "Specify that an object or a procedure is a pointer (a dynamic variable)."
28+
"doc": "Specifies that an object or a procedure is a pointer (a dynamic variable)."
29+
},
30+
"PROTECTED": {
31+
"doc": "Specifies limitations on the use of module entities."
1732
},
1833
"TARGET": {
19-
"doc": "Specify that an object can become the target of a pointer."
34+
"doc": "Specifies that an object can become the target of a pointer (it can be pointed to)."
35+
},
36+
"VOLATILE": {
37+
"doc": "Specifies that the value of an object is entirely unpredictable, based on information local to the current program unit. It prevents objects from being optimized during compilation."
2038
}
2139
},
2240
"arg": {
2341
"INTENT(IN)": {
24-
"doc": "Specify the intended use of one or more dummy arguments."
42+
"doc": "Specifies that the dummy argument will be used only to provide data to the procedure."
2543
},
2644
"INTENT(OUT)": {
27-
"doc": "Specify the intended use of one or more dummy arguments."
45+
"doc": "Specifies that the dummy argument will be used to pass data from the procedure back to the calling program."
2846
},
2947
"INTENT(INOUT)": {
30-
"doc": "Specify the intended use of one or more dummy arguments."
48+
"doc": "Specifies that the dummy argument can both provide data to the procedure and return data to the calling program."
3149
},
3250
"OPTIONAL": {
33-
"doc": "Allow dummy arguments to be omitted in a procedure reference."
51+
"doc": "Permits dummy arguments to be omitted in a procedure reference."
3452
},
3553
"SAVE": {
36-
"doc": "Cause the values and definition of objects to be retained after execution of a RETURN or END statement in a subprogram."
54+
"doc": "Causes the values and definition of objects to be retained after execution of a RETURN or END statement in a subprogram."
55+
},
56+
"VALUE": {
57+
"doc": "Specifies a type of argument association for a dummy argument."
3758
}
3859
},
3960
"type_mem": {
4061
"DEFERRED": {
41-
"doc": "Indicate that the procedure is deferred. Deferred bindings must only be specified for derived-type definitions with the ABSTRACT attribute."
62+
"doc": "Indicates that the procedure is deferred. Deferred bindings must only be specified for derived-type definitions with the ABSTRACT attribute."
4263
},
4364
"NON_OVERRIDABLE": {
44-
"doc": "Determine whether a binding can be overridden in an extended type."
65+
"doc": "Determines whether a binding can be overridden in an extended type. You must not specify NON_OVERRIDABLE for a binding with the DEFERRED attribute."
4566
},
4667
"NOPASS": {
4768
"doc": "Indicate that the procedure has no passed-object dummy argument."
4869
},
4970
"PASS": {
50-
"doc": "Define the 'passed-object dummy argument' of the procedure.",
71+
"doc": "Indicates that the procedure has no passed-object dummy argument.",
5172
"args": "arg_name"
5273
}
5374
},

fortls/statements.json

Lines changed: 67 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,71 @@
1212
},
1313
"int_stmnts": {
1414
"ALLOCATE": {
15-
"doc": "Dynamically create storage for allocatable variables and pointer targets."
15+
"doc": "Dynamically creates storage for allocatable variables and pointer targets."
16+
},
17+
"BACKSPACE": {
18+
"doc": "Positions a sequential file at the beginning of the preceding record, making it available for subsequent I/O processing."
1619
},
1720
"CALL": {
1821
"doc": "Transfers control to a subroutine subprogram."
1922
},
2023
"CLOSE": {
21-
"doc": "Disconnect a file from a unit."
24+
"doc": "Disconnects a file from a unit."
25+
},
26+
"CONTINUE": {
27+
"doc": "Primarily used to terminate a labelled DO construct when the construct would otherwise end improperly with either a GO TO, arithmetic IF, or other prohibited control statement."
2228
},
2329
"CYCLE": {
24-
"doc": "Interrupt the current execution cycle of the innermost (or named) DO construct."
30+
"doc": "Interrupts the current execution cycle of the innermost (or named) DO construct."
2531
},
2632
"DEALLOCATE": {
27-
"doc": "Free the storage allocated for allocatable variables and nonprocedure pointer targets (and causes the pointers to become disassociated)."
33+
"doc": "Frees the storage allocated for allocatable variables and nonprocedure pointer targets (and causes the pointers to become disassociated)."
34+
},
35+
"ENDFILE": {
36+
"doc": "For sequential files, writes an end-of-file record to the file and positions the file after this record (the terminal point)."
37+
},
38+
"ERROR STOP": {
39+
"doc": "Initiates error termination of an image before the execution of an END statement of the main program."
40+
},
41+
"EVENT POST": {
42+
"doc": "Allows an image to notify another image that it can proceed to work on tasks that use common resources."
43+
},
44+
"EVENT WAIT": {
45+
"doc": "Allows an image to wait on events posted by other images."
46+
},
47+
"FAIL IMAGE": {
48+
"doc": "Forces the failure of the current image of the program unit."
49+
},
50+
"FLUSH": {
51+
"doc": "Causes data written to a file to become available to other processes or causes data written to a file outside of Fortran to be accessible to a READ statement."
52+
},
53+
"FORM TEAM": {
54+
"args": "team_number,team_variable",
55+
"doc": "Defines team variables; creates one or more teams of images from the images on the current team."
2856
},
2957
"FORMAT": {
30-
"doc": "Specify the form of data being transferred and the data conversion (editing) required to achieve that form."
58+
"doc": "Specifies the form of data being transferred and the data conversion (editing) required to achieve that form."
3159
},
3260
"INQUIRE": {
33-
"doc": "Return information on the status of specified properties of a file, logical unit, or directory."
61+
"doc": "Returns information on the status of specified properties of a file or logical unit."
62+
},
63+
"LOCK": {
64+
"doc": "Causes a lock variable to become locked by an image."
3465
},
3566
"NAMELIST": {
3667
"doc": "Associates a name with a list of variables. This group name can be referenced in some input/output operations."
3768
},
3869
"NULLIFY": {
39-
"doc": "Disassociate a pointer from a target."
70+
"doc": "Disassociates a pointer from a target."
4071
},
4172
"OPEN": {
42-
"doc": "Connect an external file to a unit, creates a new file and connects it to a unit, creates a preconnected file, or changes certain properties of a connection."
73+
"doc": "Connects an external file to a unit, creates a new file and connects it to a unit, creates a preconnected file, or changes certain properties of a connection."
74+
},
75+
"PRINT": {
76+
"doc": "Displays output on the screen."
4377
},
4478
"READ": {
45-
"doc": "Transfer input data from external sequential, direct-access, or internal records."
79+
"doc": "Transfers input data from external sequential, direct-access, or internal records."
4680
},
4781
"RETURN": {
4882
"doc": "Return control to the calling program unit."
@@ -51,10 +85,32 @@
5185
"doc": "Positions a sequential or direct access file at the beginning of the file (the initial point)."
5286
},
5387
"STOP": {
54-
"doc": "Terminate execution of the program."
88+
"doc": "Initiates normal termination of an image before the execution of an END statement of the main program."
89+
},
90+
"SYNC ALL": {
91+
"args": "STAT=stat,ERRMSG=errmsg",
92+
"doc": "Performs a synchronization of all images in the current team."
93+
},
94+
"SYNC IMAGES": {
95+
"args": "image_set,STAT=stat,ERRMSG=errmsg",
96+
"doc": "Performs a synchronization of the image with each of the other images in the image set."
97+
},
98+
"SYNC MEMORY": {
99+
"args": "STAT=stat,ERRMSG=errmsg",
100+
"doc": "Ends one image segment and begins another. Each segment can then be ordered in some way with respect to segments on other images."
101+
},
102+
"SYNC TEAM": {
103+
"args": "team_value,STAT=stat,ERRMSG=errmsg",
104+
"doc": "Performs a synchronization of all images on the specified team."
105+
},
106+
"UNLOCK": {
107+
"doc": "Causes a lock variable to become unlocked by an image."
108+
},
109+
"WAIT": {
110+
"doc": "Performs a wait operation for a specified pending asynchronous data transfer operation."
55111
},
56112
"WRITE": {
57-
"doc": "Transfer output data to external sequential, direct-access, or internal records."
113+
"doc": "Transfers output data to external sequential, direct-access, or internal records."
58114
}
59115
}
60116
}

test/test_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def comp_request(file_path, line, char):
265265
file_path = test_dir / "subdir" / "test_free.f90"
266266
string += comp_request(file_path, 10, 22)
267267
string += comp_request(file_path, 14, 27)
268-
string += comp_request(file_path, 28, 14)
268+
string += comp_request(file_path, 28, 15)
269269
file_path = test_dir / "subdir" / "test_fixed.f"
270270
string += comp_request(file_path, 15, 8)
271271
string += comp_request(file_path, 15, 21)

0 commit comments

Comments
 (0)