junichi11 commented on a change in pull request #2324:
URL: https://github.com/apache/netbeans/pull/2324#discussion_r537440833



##########
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);

Review comment:
       @jlahoda We get this in an output window when we run a module.  What is 
this for?
   ```
   mimeTypes=[text/xml, text/x-properties, text/plain, text/x-diff, 
content/unknown, text/x-php5]
   mimeTypes=[text/xml, text/x-properties, text/plain, text/x-diff, 
content/unknown, text/x-php5]
   mimeTypes=[text/xml, text/x-properties, text/plain, text/x-diff, 
content/unknown, text/x-php5]
   mimeTypes=[text/xml, text/x-properties, text/plain, text/x-diff, 
content/unknown, text/x-php5]
   mimeTypes=[text/xml, text/x-properties, text/plain, text/x-diff, 
content/unknown, text/x-php5]
   mimeTypes=[text/xml, text/x-properties, text/plain, text/x-diff, 
content/unknown, text/x-php5]
   mimeTypes=[text/xml, text/x-properties, text/plain, text/x-diff, 
content/unknown, text/x-php5]
   INFO [org.netbeans.modules.bugtracking.BugtrackingManager]: Loading stored 
repositories took 47 millis.
   mimeTypes=[text/xml, text/x-properties, text/plain, text/x-diff, 
content/unknown, text/x-php5]
   mimeTypes=[text/xml, text/x-properties, text/plain, text/x-diff, 
content/unknown, text/x-php5]
   mimeTypes=[text/xml, text/x-properties, text/plain, text/x-diff, 
content/unknown, text/x-php5]
   mimeTypes=[text/xml, text/x-properties, text/plain, text/x-diff, 
content/unknown, text/x-php5]
   ```




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