Skip to content

Commit ba96a2f

Browse files
committed
Fix some comments
1 parent 7020f4e commit ba96a2f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

server/src/server.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,12 @@ let getOpenedFileContent = (fileUri: string) => {
148148

149149
process.on('message', (a: (m.RequestMessage | m.NotificationMessage)) => {
150150
if ((a as m.RequestMessage).id == null) {
151-
// this is a notification message, aka client sent and forgot
151+
// this is a notification message, aka the client ends it and doesn't want a reply
152152
let aa = (a as m.NotificationMessage)
153153
if (!initialized && aa.method !== 'exit') {
154154
// From spec: "Notifications should be dropped, except for the exit notification. This will allow the exit of a server without an initialize request"
155155
// For us: do nothing. We don't have anything we need to clean up right now
156+
// TODO: we might have things we need to clean up now... like some watcher stuff
156157
} else if (aa.method === 'exit') {
157158
// The server should exit with success code 0 if the shutdown request has been received before; otherwise with error code 1
158159
if (shutdownRequestAlreadyReceived) {
@@ -183,7 +184,7 @@ process.on('message', (a: (m.RequestMessage | m.NotificationMessage)) => {
183184
closedFile(params.textDocument.uri)
184185
}
185186
} else {
186-
// this is a request message, aka client sent request, waits for our reply
187+
// this is a request message, aka client sent request and waits for our mandatory reply
187188
let aa = (a as m.RequestMessage)
188189
if (!initialized && aa.method !== 'initialize') {
189190
let response: m.ResponseMessage = {
@@ -196,7 +197,7 @@ process.on('message', (a: (m.RequestMessage | m.NotificationMessage)) => {
196197
};
197198
process.send!(response);
198199
} else if (aa.method === 'initialize') {
199-
// send the list of things we support
200+
// send the list of features we support
200201
let result: p.InitializeResult = {
201202
capabilities: {
202203
// TODO: incremental sync?
@@ -245,10 +246,10 @@ process.on('message', (a: (m.RequestMessage | m.NotificationMessage)) => {
245246
}
246247
} else if (aa.method === p.DocumentFormattingRequest.method) {
247248
// technically, a formatting failure should reply with the error. Sadly
248-
// the LSP alert box for these error replies suck (e.g. don't actually
249+
// the LSP alert box for these error replies sucks (e.g. doesn't actually
249250
// display the message). In order to signal the client to display a proper
250251
// alert box (sometime with actionable buttons), we need to first send
251-
// back a fake success message (because reach request mandates a
252+
// back a fake success message (because each request mandates a
252253
// response), then right away send a server notification to display a
253254
// nicer alert. Ugh.
254255
let fakeSuccessResponse: m.ResponseMessage = {

0 commit comments

Comments
 (0)