More log info to debug atom language server open/close events
This commit is contained in:
@@ -151,7 +151,9 @@ public class SimpleTextDocumentService implements TextDocumentService {
|
||||
int version = docId.getVersion();
|
||||
if (url!=null) {
|
||||
String text = params.getTextDocument().getText();
|
||||
TextDocument doc = createDocument(url, languageId, version, text).open().getDocument();
|
||||
TrackedDocument td = createDocument(url, languageId, version, text).open();
|
||||
Log.info("Opened "+td.getOpenCount()+" times: "+url);
|
||||
TextDocument doc = td.getDocument();
|
||||
TextDocumentContentChangeEvent change = new TextDocumentContentChangeEvent() {
|
||||
@Override
|
||||
public Range getRange() {
|
||||
@@ -181,13 +183,14 @@ public class SimpleTextDocumentService implements TextDocumentService {
|
||||
TrackedDocument doc = documents.get(url);
|
||||
if (doc!=null) {
|
||||
if (doc.close()) {
|
||||
Log.info("Closed: "+url);
|
||||
//Clear diagnostics when a file is closed. This makes the errors disapear when the language is changed for
|
||||
// a document (this resulst in a dicClose even as being sent to the language server if that changes make the
|
||||
// document go 'out of scope'.
|
||||
publishDiagnostics(params.getTextDocument(), ImmutableList.of());
|
||||
documents.remove(url);
|
||||
}
|
||||
Log.warn("Close event ignored! Assuming document still open because of its openCount");
|
||||
Log.warn("Close event ignored! Assuming document still open because of its openCount ["+doc.getOpenCount()+"]");
|
||||
} else {
|
||||
Log.warn("Document closed, but it didn't exist! Close event ignored");
|
||||
}
|
||||
|
||||
@@ -49,4 +49,8 @@ public class TrackedDocument {
|
||||
return openCount<=0;
|
||||
}
|
||||
|
||||
public int getOpenCount() {
|
||||
return openCount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -297,5 +297,4 @@ public class TextDocument implements IDocument {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user