Skip to content

Commit 0142b35

Browse files
authored
Merge pull request #623 from fortran-lang/feat/lint-int
2 parents 9ee9a8a + 6f10935 commit 0142b35

11 files changed

+317
-287
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99

1010
### Added
1111

12+
- Added capability for linter options to update automatically when settings change
13+
([#623](https://github.com/fortran-lang/vscode-fortran-support/pull/623))
14+
- Added unittests for `spawnAsPromise` to increase test coverage
15+
([#623](https://github.com/fortran-lang/vscode-fortran-support/pull/623))
1216
- Added option to set the verbosity of the Output Channel
1317
([#606](https://github.com/fortran-lang/vscode-fortran-support/pull/606))
1418
- Added increased logging messages in various parts of the extension
1519
([#606](https://github.com/fortran-lang/vscode-fortran-support/pull/606))
1620

1721
### Changed
1822

23+
- Changed the linter to be asynchronous, should imprpove performance
24+
([#623](https://github.com/fortran-lang/vscode-fortran-support/pull/623))
25+
- Changed native `SymbolProvider` to use non-deprecated constructor
26+
([#623](https://github.com/fortran-lang/vscode-fortran-support/pull/623))
1927
- Changed how caching is performed in the linter; generalised code and improved
2028
performance of the cache
2129
([#611](https://github.com/fortran-lang/vscode-fortran-support/pull/611))
@@ -30,9 +38,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3038

3139
### Fixed
3240

41+
- Fixed issues with linter unittests running asynchronously
42+
([#623](https://github.com/fortran-lang/vscode-fortran-support/pull/623))
3343
- Fixed `npm run watch-dev` not syncing changes to spawned Extension Dev Host
3444
([#602](https://github.com/fortran-lang/vscode-fortran-support/issues/602))
3545

46+
### Removed
47+
48+
- Removed unused tokenizer code
49+
([#623](https://github.com/fortran-lang/vscode-fortran-support/pull/623))
50+
3651
## [3.2.0]
3752

3853
### Added

src/features/document-symbol-provider.ts

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import {
2-
CancellationToken,
3-
TextDocument,
4-
Position,
5-
Hover,
6-
TextLine,
7-
SymbolInformation,
8-
} from 'vscode';
1+
import { CancellationToken, TextDocument, TextLine, SymbolInformation } from 'vscode';
92

103
import * as vscode from 'vscode';
114
import {
@@ -16,7 +9,7 @@ import { parseVars as getDeclaredVar } from '../lib/variables';
169
import { EXTENSION_ID } from '../lib/tools';
1710

1811
type SymbolType = 'subroutine' | 'function' | 'variable';
19-
type ParserFunc = (line: TextLine) => SymbolInformation | undefined;
12+
type ParserFunc = (document: TextDocument, line: TextLine) => SymbolInformation | undefined;
2013

2114
export class FortranDocumentSymbolProvider implements vscode.DocumentSymbolProvider {
2215
vars: Array<vscode.SymbolInformation>;
@@ -47,7 +40,7 @@ export class FortranDocumentSymbolProvider implements vscode.DocumentSymbolProvi
4740
if (initialCharacter === '!' || initialCharacter === '#') continue;
4841
const symbolsInLine = symbolTypes
4942
.map(type => this.getSymbolsOfType(type))
50-
.map(fn => fn(line))
43+
.map(fn => fn(document, line))
5144
.filter(symb => symb !== undefined);
5245
if (symbolsInLine.length > 0) {
5346
symbols = symbols.concat(symbolsInLine);
@@ -62,39 +55,53 @@ export class FortranDocumentSymbolProvider implements vscode.DocumentSymbolProvi
6255
return this.parseSubroutineDefinition;
6356
case 'function':
6457
return this.parseFunctionDefinition;
65-
6658
case 'variable':
6759
return this.parseVariableDefinition;
6860
default:
6961
return () => undefined;
7062
}
7163
}
7264

73-
private parseSubroutineDefinition(line: TextLine) {
65+
private parseSubroutineDefinition(document: TextDocument, line: TextLine) {
7466
try {
7567
const subroutine = getDeclaredSubroutine(line);
7668
if (subroutine) {
7769
const range = new vscode.Range(line.range.start, line.range.end);
78-
return new vscode.SymbolInformation(subroutine.name, vscode.SymbolKind.Function, range);
70+
return new vscode.SymbolInformation(
71+
subroutine.name,
72+
vscode.SymbolKind.Function,
73+
document.fileName,
74+
new vscode.Location(document.uri, range)
75+
);
7976
}
8077
} catch (err) {
8178
console.log(err);
8279
}
8380
}
8481

85-
private parseFunctionDefinition(line: TextLine) {
82+
private parseFunctionDefinition(document: TextDocument, line: TextLine) {
8683
const fun = getDeclaredFunction(line);
8784
if (fun) {
8885
const range = new vscode.Range(line.range.start, line.range.end);
89-
return new vscode.SymbolInformation(fun.name, vscode.SymbolKind.Function, range);
86+
return new vscode.SymbolInformation(
87+
fun.name,
88+
vscode.SymbolKind.Function,
89+
document.fileName,
90+
new vscode.Location(document.uri, range)
91+
);
9092
}
9193
}
9294

93-
private parseVariableDefinition(line: TextLine) {
95+
private parseVariableDefinition(document: TextDocument, line: TextLine) {
9496
const variable = getDeclaredVar(line);
9597
if (variable) {
9698
const range = new vscode.Range(line.range.start, line.range.end);
97-
return new vscode.SymbolInformation(variable.name, vscode.SymbolKind.Variable, range);
99+
return new vscode.SymbolInformation(
100+
variable.name,
101+
vscode.SymbolKind.Variable,
102+
document.fileName,
103+
new vscode.Location(document.uri, range)
104+
);
98105
}
99106
}
100107

0 commit comments

Comments
 (0)