jlahoda-jackpot commented on a change in pull request #2324:
URL: https://github.com/apache/netbeans/pull/2324#discussion_r475135035



##########
File path: 
ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/CustomIndexerImpl.java
##########
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.lsp.client.bindings;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.function.Consumer;
+import org.netbeans.api.editor.mimelookup.MimeRegistration;
+import org.netbeans.api.project.FileOwnerQuery;
+import org.netbeans.api.project.Project;
+import org.netbeans.modules.lsp.client.LSPBindings;
+import org.netbeans.modules.parsing.spi.indexing.Context;
+import org.netbeans.modules.parsing.spi.indexing.CustomIndexer;
+import org.netbeans.modules.parsing.spi.indexing.CustomIndexerFactory;
+import org.netbeans.modules.parsing.spi.indexing.Indexable;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.EditableProperties;
+import org.openide.util.Exceptions;
+import org.openide.util.RequestProcessor;
+
+/**
+ *
+ * @author lahvac
+ */
+public class CustomIndexerImpl extends CustomIndexer {
+
+    private static final RequestProcessor WORKER = new 
RequestProcessor(CustomIndexerImpl.class.getName(), 1, false, false);
+
+    @Override
+    protected void index(Iterable<? extends Indexable> files, Context context) 
{
+        handleStoredFiles(context, props -> {
+            FileObject root = context.getRoot();
+            for (Indexable i : files) {
+                FileObject file = root.getFileObject(i.getRelativePath());
+                if (file != null) {
+                    props.setProperty(i.getRelativePath(), 
FileUtil.getMIMEType(file));
+                }
+            }
+
+            Set<String> mimeTypes = new HashSet<>(props.values());
+            System.err.println("mimeTypes=" + mimeTypes);
+            Project prj = FileOwnerQuery.getOwner(root);
+
+            if (prj != null) {
+                WORKER.post(() -> {
+                    for (String mimeType : mimeTypes) {

Review comment:
       Jackpot:
   warning: Can use functional operations

##########
File path: 
ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/SymbolProviderImpl.java
##########
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.lsp.client.bindings;
+
+import javax.swing.Icon;
+import org.eclipse.lsp4j.SymbolInformation;
+import org.netbeans.spi.jumpto.symbol.SymbolDescriptor;
+import org.netbeans.spi.jumpto.symbol.SymbolProvider;
+import org.openide.filesystems.FileObject;
+import org.openide.util.NbBundle.Messages;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author lahvac
+ */
+@ServiceProvider(service=SymbolProvider.class)
+public class SymbolProviderImpl extends BaseSymbolProvider implements 
SymbolProvider {
+
+    @Override
+    @Messages("DN_getDisplayName=Language Server Symbol Provider")
+    public String getDisplayName() {
+        return Bundle.DN_Symbols();
+    }
+
+    @Override
+    public void computeSymbolNames(Context context, Result result) {
+        computeSymbolNames(context.getSearchType(), context.getText(), (info, 
simpleName) -> result.addResult(new SymbolDescriptorImpl(info, simpleName)));
+    }
+
+    public static class SymbolDescriptorImpl extends SymbolDescriptor 
implements BaseSymbolDescriptor {
+
+        private final SymbolInformation info;
+        private final String simpleName;
+
+        public SymbolDescriptorImpl(SymbolInformation info, String simpleName) 
{
+            this.info = info;
+            this.simpleName = simpleName;
+        }
+
+        public SymbolInformation getInfo() {

Review comment:
       Jackpot:
   warning: Add @Override Annotation




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