Skip to content

Commit 24f83bd

Browse files
Dafny project file improvements (#475)
### Changes - No longer let the syntax definitions for .dfy files also be applied to dfyconfig.toml files - Activate extension when `.toml` file is opened, such as a `dfyconfig.toml` - Let the language client also operate on files ending in `dfyconfig.toml` ### Testing - Manually tested that only opening a `dfyconfig.toml` will already trigger the extension and provide diagnostics. - Manually tested that making changing in a `dfyconfig.toml` file causes diagnostics to be updated - Manually tested that syntax highlighting for `dfyconfig.toml` files works correctly.
1 parent 668ec8b commit 24f83bd

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed
File renamed without changes.

package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"bugs": {
1212
"url": "https://github.com/dafny-lang/ide-vscode/issues"
1313
},
14+
"activationEvents": [
15+
"onLanguage:toml"
16+
],
1417
"qna": false,
1518
"license": "MIT",
1619
"galleryBanner": {
@@ -123,10 +126,9 @@
123126
],
124127
"extensions": [
125128
".dfy",
126-
".dfyi",
127-
"dfyconfig.toml"
129+
".dfyi"
128130
],
129-
"configuration": "./language-configuration.json"
131+
"configuration": "./dafny-language-configuration.json"
130132
}
131133
],
132134
"grammars": [
@@ -309,7 +311,6 @@
309311
}
310312
]
311313
},
312-
"activationEvents": [],
313314
"scripts": {
314315
"vscode:prepublish": "npm run package",
315316
"compile": "webpack",

src/language/dafnyLanguageClient.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,11 @@ export class DafnyLanguageClient extends LanguageClient {
152152
};
153153
const diagnosticsListeners: ((uri: Uri, diagnostics: Diagnostic[]) => void)[] = [];
154154
const clientOptions: LanguageClientOptions = {
155-
documentSelector: [ DafnyDocumentFilter ],
155+
documentSelector: [ DafnyDocumentFilter, {
156+
scheme: 'file',
157+
pattern: '**/*dfyconfig.toml'
158+
}
159+
],
156160
diagnosticCollectionName: LanguageServerId,
157161
middleware: {
158162
handleDiagnostics: (uri: Uri, diagnostics: Diagnostic[], next: HandleDiagnosticsSignature) => {

0 commit comments

Comments
 (0)