dbalek commented on a change in pull request #2812:
URL: https://github.com/apache/netbeans/pull/2812#discussion_r597471923



##########
File path: 
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TextDocumentServiceImpl.java
##########
@@ -301,35 +309,88 @@ public void indexingComplete(Set<URL> indexedRoots) {
             EditorCookie ec = file.getLookup().lookup(EditorCookie.class);
             Document doc = ec.openDocument();
             final int caret = Utils.getOffset(doc, params.getPosition());
-            ParserManager.parse(Collections.singletonList(Source.create(doc)), 
new UserTask() {
-                @Override
-                public void run(ResultIterator resultIterator) throws 
Exception {
-                    TokenSequence<JavaTokenId> ts = 
resultIterator.getSnapshot().getTokenHierarchy().tokenSequence(JavaTokenId.language());
-                    if (ts.move(caret) == 0 || !ts.moveNext()) {
-                        if (!ts.movePrevious()) {
-                            ts.moveNext();
+            String mimeType = file.getMIMEType();
+            if ("text/x-java".equals(mimeType)) {
+                
ParserManager.parse(Collections.singletonList(Source.create(doc)), new 
UserTask() {

Review comment:
       Done.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
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

Reply via email to