Skip to content

Commit d663f28

Browse files
committed
Fix parsing of the switch statement.
1 parent 4b71dda commit d663f28

File tree

6 files changed

+27
-18
lines changed

6 files changed

+27
-18
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.2.2
4+
5+
Fix parsing of the `switch` statement.
6+
37
## 0.2.1
48

59
Fix the dependency on oscript-ast-walker.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"name": "vscode-oscript",
33
"displayName": "OScript Language",
44
"description": "Provides syntax checking and fixing, highlighting, autocompletion, hints, symbol outline, identifier recognition and renaming and other features for the OScript language in Visual Studio Code.",
5-
"version": "0.2.1",
5+
"version": "0.2.2",
6+
"icon": "doc/logo.png",
67
"publisher": "prantlf",
78
"author": {
89
"name": "Ferdinand Prantl",

pkg/server/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/server/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "oscript-language-server",
33
"description": "Syntax checking, highlighting, hover hints and other support for the OScript language in Visual Studio Code.",
4-
"version": "0.0.2",
4+
"version": "0.0.3",
55
"author": {
66
"name": "Ferdinand Prantl",
77
"email": "prantlf@gmail.com",
@@ -35,7 +35,7 @@
3535
"devDependencies": {
3636
"@rollup/plugin-yaml": "3.0.0",
3737
"oscript-ast-walker": "0.0.1",
38-
"oscript-parser": "0.2.0",
38+
"oscript-parser": "0.2.1",
3939
"rollup-plugin-copy": "3.3.0",
4040
"vscode-languageserver": "7.0.0",
4141
"vscode-languageserver-textdocument": "1.0.1"

pkg/server/rollup.config.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import { nodeResolve } from '@rollup/plugin-node-resolve'
21
import yaml from '@rollup/plugin-yaml'
32
import copy from 'rollup-plugin-copy'
43
import config from '../rollup.shared'
54

65
export default config('server', [
7-
nodeResolve(),
86
yaml(),
97
copy({
108
targets: [

pkg/server/src/server.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import {
55
ShowMessageNotification, MessageType, WorkspaceFolder, WorkspaceFoldersChangeEvent,
66
DocumentSymbolParams, SymbolInformation, DocumentSymbol, RenameParams,
77
WorkspaceEdit, Range, CodeActionKind, CodeActionParams, CodeAction,
8-
ReferenceParams, Location, TextDocumentIdentifier
8+
ReferenceParams, Location, TextDocumentIdentifier, TextDocumentChangeEvent,
9+
DidChangeWatchedFilesParams, DidChangeConfigurationParams
910
} from 'vscode-languageserver/node'
1011
import { TextDocument } from 'vscode-languageserver-textdocument'
1112
import {
@@ -67,7 +68,7 @@ const documents = new TextDocuments(TextDocument)
6768
const pendingValidationRequests: Map<string, NodeJS.Timer> = new Map
6869
const validationDelay = 200
6970

70-
connection.onInitialize((params: InitializeParams) => {
71+
connection.onInitialize((params: InitializeParams): InitializeResult => {
7172
workspaceRoot = params.rootUri
7273
workspaceFolders = params.workspaceFolders || []
7374

@@ -117,7 +118,7 @@ connection.onInitialize((params: InitializeParams) => {
117118
return result
118119
})
119120

120-
connection.onInitialized(() => {
121+
connection.onInitialized((): void => {
121122
if (hasConfigurationCapability) {
122123
connection.client.register(DidChangeConfigurationNotification.type, undefined)
123124
}
@@ -161,7 +162,7 @@ function updateLogLevel () {
161162
.then(settings => setLevel(settings.logging.level))
162163
}
163164

164-
connection.onDidChangeConfiguration(event => {
165+
connection.onDidChangeConfiguration((event: DidChangeConfigurationParams): void => {
165166
logDebug('configuration changed')
166167
documentExtras.clear()
167168
if (!hasConfigurationCapability) {
@@ -208,7 +209,7 @@ async function ensureDocumentExtras(document: TextDocument): Promise<DocumentExt
208209
return extras
209210
}
210211

211-
documents.onDidChangeContent(event => {
212+
documents.onDidChangeContent((event: TextDocumentChangeEvent<TextDocument>): void => {
212213
const { document } = event
213214
const { uri } = document
214215
logDebug('document changed - %1', uri)
@@ -217,26 +218,31 @@ documents.onDidChangeContent(event => {
217218
triggerValidation(document)
218219
})
219220

221+
documents.onDidOpen((event: TextDocumentChangeEvent<TextDocument>): void => {
222+
const { document } = event
223+
logDebug('document opened - %1', document.uri)
224+
triggerValidation(document)
225+
})
226+
220227
function invalidateExtras(extras: DocumentExtras): void {
221228
extras.error = extras.ast = extras.tokens = extras.warnings = undefined
222229
}
223230

224-
documents.onDidClose(event => {
231+
documents.onDidClose((event: TextDocumentChangeEvent<TextDocument>): void => {
225232
const { document } = event
226233
const { uri } = document
227234
logDebug('document closed - %1', uri)
228235
documentExtras.delete(uri)
229236
cancelValidation(document)
230237
})
231238

232-
connection.onDidChangeWatchedFiles(event => {
239+
connection.onDidChangeWatchedFiles((event: DidChangeWatchedFilesParams): void => {
233240
if (wantDebug()) {
234241
logDebug('watched files changed - %1',
235242
JSON.stringify(event.changes.map(({ uri }) => uri)))
236243
}
237244
event.changes.forEach(change => {
238-
const { uri } = change
239-
const document = documents.get(uri)
245+
const document = documents.get(change.uri)
240246
if (document) triggerValidation(document)
241247
})
242248
})

0 commit comments

Comments
 (0)