This is an automated email from the ASF dual-hosted git repository.
lkishalmi pushed a commit to branch delivery
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/delivery by this push:
new 97cf432 Fixing registration of Mark occurences and Breadcrumbs for
lsp.client.
97cf432 is described below
commit 97cf432ba6667811ec0fe8fbb6d1f023f3b79ce7
Author: Jan Lahoda <[email protected]>
AuthorDate: Sun Oct 25 20:41:27 2020 +0100
Fixing registration of Mark occurences and Breadcrumbs for lsp.client.
---
.../TextDocumentSyncServerCapabilityHandler.java | 30 ++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git
a/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/TextDocumentSyncServerCapabilityHandler.java
b/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/TextDocumentSyncServerCapabilityHandler.java
index 81d98c0..efad9aa 100644
---
a/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/TextDocumentSyncServerCapabilityHandler.java
+++
b/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/TextDocumentSyncServerCapabilityHandler.java
@@ -98,6 +98,7 @@ public class TextDocumentSyncServerCapabilityHandler {
Document doc = opened.getDocument();
ensureDidOpenSent(doc);
+ registerBackgroundTasks(opened);
}
public static void refreshOpenedFilesInServers() {
@@ -237,6 +238,7 @@ public class TextDocumentSyncServerCapabilityHandler {
return; //ignore
documentOpened(doc);
+ registerBackgroundTasks(c);
openDocument2PanesCount.compute(doc, (d, count) -> count + 1);
}
@@ -308,4 +310,32 @@ public class TextDocumentSyncServerCapabilityHandler {
server.scheduleBackgroundTasks(file);
});
}
+
+ private void registerBackgroundTasks(JTextComponent c) {
+ Document doc = c.getDocument();
+ WORKER.post(() -> {
+ FileObject file = NbEditorUtilities.getFileObject(doc);
+
+ if (file == null)
+ return; //ignore
+
+ LSPBindings server = LSPBindings.getBindings(file);
+
+ if (server == null)
+ return ; //ignore
+
+ SwingUtilities.invokeLater(() -> {
+ if (c.getClientProperty(MarkOccurrences.class) == null) {
+ MarkOccurrences mo = new MarkOccurrences(c);
+ LSPBindings.addBackgroundTask(file, mo);
+ c.putClientProperty(MarkOccurrences.class, mo);
+ }
+ if (c.getClientProperty(BreadcrumbsImpl.class) == null) {
+ BreadcrumbsImpl bi = new BreadcrumbsImpl(c);
+ LSPBindings.addBackgroundTask(file, bi);
+ c.putClientProperty(BreadcrumbsImpl.class, bi);
+ }
+ });
+ });
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists