You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ge...@apache.org on 2021/04/01 07:53:14 UTC

[netbeans] branch master updated: [NETBEANS-5221] Only warn about missing Node.js once.

This is an automated email from the ASF dual-hosted git repository.

geertjan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new ccf7e6c  [NETBEANS-5221] Only warn about missing Node.js once.
     new a23e3c9  Merge pull request #2850 from jlahoda/NETBEANS-5221
ccf7e6c is described below

commit ccf7e6c46076f59c01ae029cdce359fa0ce84553
Author: Jan Lahoda <jl...@netbeans.org>
AuthorDate: Wed Mar 31 23:11:16 2021 +0200

    [NETBEANS-5221] Only warn about missing Node.js once.
---
 .../org/netbeans/modules/typescript/editor/TypeScriptLSP.java | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/webcommon/typescript.editor/src/org/netbeans/modules/typescript/editor/TypeScriptLSP.java b/webcommon/typescript.editor/src/org/netbeans/modules/typescript/editor/TypeScriptLSP.java
index 68687d8..3f3176e 100644
--- a/webcommon/typescript.editor/src/org/netbeans/modules/typescript/editor/TypeScriptLSP.java
+++ b/webcommon/typescript.editor/src/org/netbeans/modules/typescript/editor/TypeScriptLSP.java
@@ -20,6 +20,7 @@ package org.netbeans.modules.typescript.editor;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import org.netbeans.api.editor.mimelookup.MimeRegistration;
@@ -39,6 +40,8 @@ import org.openide.util.NbBundle.Messages;
 @MimeRegistration(mimeType="application/x-typescript", service=LanguageServerProvider.class)
 public class TypeScriptLSP implements LanguageServerProvider {
 
+    private final AtomicBoolean missingNodeWarningIssued = new AtomicBoolean();
+
     @Override
     @Messages({"WARN_NoNode=node.js not found, TypeScript support disabled.",
                "DESC_NoNode=Please specify node.js location in the Tools/Options, and restart the IDE."
@@ -46,9 +49,11 @@ public class TypeScriptLSP implements LanguageServerProvider {
     public LanguageServerDescription startServer(Lookup lookup) {
         String node = NodeJsSupport.getInstance().getNode(null);
         if (node == null || node.isEmpty()) {
-            NotificationDisplayer.getDefault().notify(Bundle.WARN_NoNode(), ImageUtilities.loadImageIcon("org/netbeans/modules/typescript/editor/icon.png", true), Bundle.DESC_NoNode(), evt -> {
-                OptionsDisplayer.getDefault().open("Html5/NodeJs");
-            });
+            if (!missingNodeWarningIssued.getAndSet(true)) {
+                NotificationDisplayer.getDefault().notify(Bundle.WARN_NoNode(), ImageUtilities.loadImageIcon("org/netbeans/modules/typescript/editor/icon.png", true), Bundle.DESC_NoNode(), evt -> {
+                    OptionsDisplayer.getDefault().open("Html5/NodeJs");
+                });
+            }
             return null;
         }
         File server = InstalledFileLocator.getDefault().locate("typescript-lsp/node_modules/typescript-language-server/lib/cli.js", null, false);

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists