Skip to content

Commit

Permalink
Dafny project file improvements (#475)
Browse files Browse the repository at this point in the history
### 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.
  • Loading branch information
keyboardDrummer committed May 9, 2024
1 parent 668ec8b commit 24f83bd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
File renamed without changes.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"bugs": {
"url": "https://github.com/dafny-lang/ide-vscode/issues"
},
"activationEvents": [
"onLanguage:toml"
],
"qna": false,
"license": "MIT",
"galleryBanner": {
Expand Down Expand Up @@ -123,10 +126,9 @@
],
"extensions": [
".dfy",
".dfyi",
"dfyconfig.toml"
".dfyi"
],
"configuration": "./language-configuration.json"
"configuration": "./dafny-language-configuration.json"
}
],
"grammars": [
Expand Down Expand Up @@ -309,7 +311,6 @@
}
]
},
"activationEvents": [],
"scripts": {
"vscode:prepublish": "npm run package",
"compile": "webpack",
Expand Down
6 changes: 5 additions & 1 deletion src/language/dafnyLanguageClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ export class DafnyLanguageClient extends LanguageClient {
};
const diagnosticsListeners: ((uri: Uri, diagnostics: Diagnostic[]) => void)[] = [];
const clientOptions: LanguageClientOptions = {
documentSelector: [ DafnyDocumentFilter ],
documentSelector: [ DafnyDocumentFilter, {
scheme: 'file',
pattern: '**/*dfyconfig.toml'
}
],
diagnosticCollectionName: LanguageServerId,
middleware: {
handleDiagnostics: (uri: Uri, diagnostics: Diagnostic[], next: HandleDiagnosticsSignature) => {
Expand Down

0 comments on commit 24f83bd

Please sign in to comment.