From bb5ce5d31e592da7430b1aa6e89bc7d5791d182a Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 13 Nov 2013 01:46:37 +0100 Subject: [PATCH 01/97] use file extension as keyword this way dash can be configured to show the right docsets --- .../paperetto/dash/DashLauncherAction.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/com/paperetto/dash/DashLauncherAction.java b/src/com/paperetto/dash/DashLauncherAction.java index 090cfad..9883989 100644 --- a/src/com/paperetto/dash/DashLauncherAction.java +++ b/src/com/paperetto/dash/DashLauncherAction.java @@ -10,6 +10,7 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.SelectionModel; +import com.intellij.openapi.vfs.VirtualFile; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; @@ -68,7 +69,23 @@ public void actionPerformed(AnActionEvent e) { } if(word!=null) { + // file extension + VirtualFile virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE); + String fileExtension = virtualFile != null ? virtualFile.getExtension() : null; + + if ( fileExtension != null ) { + try { + fileExtension = URLEncoder.encode(fileExtension, "UTF-8"); + } catch (UnsupportedEncodingException el){ + ///where do I print an error + return; + } + + fileExtension = fileExtension.replace("+", "%20"); + } + + // search word String searchWord; try { searchWord = URLEncoder.encode(word, "UTF-8"); @@ -79,7 +96,13 @@ public void actionPerformed(AnActionEvent e) { //URLEncoder turns spaces in to '+' we need them to be %20 searchWord = searchWord.replace("+", "%20"); - String request = "dash://" + searchWord; + String request = "dash://"; + + if ( fileExtension != null ) { + request += "." + fileExtension + ":"; + } + + request += searchWord; //now open the URL with the 'open' command String[] command = new String[]{ExecUtil.getOpenCommandPath()}; From 89121e90376c4421fd7ed28fb115ba79f5c7be61 Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 13 Nov 2013 06:15:47 +0100 Subject: [PATCH 02/97] configurable dash keywords for file types and file extensions --- .../paperetto/dash/DashLauncherAction.java | 28 +++---- src/de/dreamlab/dash/KeywordLookup.java | 77 +++++++++++++++++++ 2 files changed, 91 insertions(+), 14 deletions(-) create mode 100644 src/de/dreamlab/dash/KeywordLookup.java diff --git a/src/com/paperetto/dash/DashLauncherAction.java b/src/com/paperetto/dash/DashLauncherAction.java index 9883989..fb99798 100644 --- a/src/com/paperetto/dash/DashLauncherAction.java +++ b/src/com/paperetto/dash/DashLauncherAction.java @@ -11,11 +11,19 @@ import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.SelectionModel; import com.intellij.openapi.vfs.VirtualFile; +import de.dreamlab.dash.KeywordLookup; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class DashLauncherAction extends AnAction { + private KeywordLookup keywordLookup; + + public DashLauncherAction() + { + keywordLookup = new KeywordLookup(); + } + @Override public void update(AnActionEvent e) { @@ -69,22 +77,14 @@ public void actionPerformed(AnActionEvent e) { } if(word!=null) { - // file extension + // keyword VirtualFile virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE); - String fileExtension = virtualFile != null ? virtualFile.getExtension() : null; + String keyword = null; - if ( fileExtension != null ) { - try { - fileExtension = URLEncoder.encode(fileExtension, "UTF-8"); - } catch (UnsupportedEncodingException el){ - ///where do I print an error - return; - } - - fileExtension = fileExtension.replace("+", "%20"); + if ( virtualFile != null) { + keyword = keywordLookup.findKeyword(virtualFile.getFileType().getName(), virtualFile.getExtension()); } - // search word String searchWord; try { @@ -98,8 +98,8 @@ public void actionPerformed(AnActionEvent e) { String request = "dash://"; - if ( fileExtension != null ) { - request += "." + fileExtension + ":"; + if ( keyword != null ) { + request += keyword + ":"; } request += searchWord; diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java new file mode 100644 index 0000000..865cd78 --- /dev/null +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -0,0 +1,77 @@ +package de.dreamlab.dash; + +import com.intellij.ide.util.PropertiesComponent; + +import java.util.HashMap; + + +public class KeywordLookup { + private static String CONFIG_KEYWORDS = "DASH_INTEGRATION_KEYWORDS"; + private static String DEFAULT_KEYWORDS = "ActionScript=actionscript;C++=cpp;CoffeeScriptcoffee;Perl=perl;CSS=css;Erlang=erlang;Haskell=haskell;HTML=html;JAVA=java;CLASS=java;JavaScript=javascript;LESS=less;PHP=php;SASS=sass"; + + private HashMap typeMap; + private HashMap extensionMap; + + public KeywordLookup() + { + initDefaults(); + + extensionMap = new HashMap(); + typeMap = new HashMap(); + + String[] associations = PropertiesComponent.getInstance().getValue(CONFIG_KEYWORDS).split(";"); + for ( String association : associations ) { + String[] values = association.split("="); + + if ( values.length == 2 ) { + if ( values[0].substring(0, 1).equals(".") ) { + extensionMap.put(values[0].substring(1), values[1]); + } + else { + typeMap.put(values[0], values[1]); + } + } + } + } + + private void initDefaults() + { + /* + Associations are customizable in "~/Library/Preferences/%IDE_NAME%/options/options.xml" under the property "DASH_INTEGRATION_KEYWORDS" + %IDE_NAME% might be "WebIde60" or "IdeaIC12" + + Values pairs can be provided in a semi-colon delimited list. The value pair consists of FILE_TYPE=KEYWORD + File type names can be found in the IDE settings. Instead of file types also file extensions can be used. The file extension has to start with a dot. + + ex: HTML=html;.xhtml=html + | | + | Uses Dash keyword "html" for files with .xhtml extension (extensions have priority over file types) + Uses Dash keyword "html" for files of type HTML + */ + + PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); + + if ( !propertiesComponent.isValueSet(CONFIG_KEYWORDS) ) { + propertiesComponent.setValue(CONFIG_KEYWORDS, DEFAULT_KEYWORDS); + } + } + + public String findKeyword(String type, String extension) + { + if ( extensionMap.containsKey(extension) ) { + return extensionMap.get(extension); + } + else { + return typeMap.get(cleanType(type)); + } + } + + private String cleanType(String type) + { + type = type.replaceFirst("\\(.*\\)", ""); + type = type.replace("files", ""); + type = type.trim(); + + return type; + } +} From 4d4b802a141d06e598e9686da2c8e269669ac35a Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 13 Nov 2013 19:07:42 +0100 Subject: [PATCH 03/97] changed name, version and plugin description --- Dash.iml | 2 +- META-INF/plugin.xml | 35 ++++++++++++++++++------- src/de/dreamlab/dash/KeywordLookup.java | 6 ++--- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/Dash.iml b/Dash.iml index a2a2b68..75cbcaa 100644 --- a/Dash.iml +++ b/Dash.iml @@ -6,7 +6,7 @@ - + diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index dd66d43..03d4249 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,17 +1,34 @@ com.paperetto.dash - Dash Launcher - 1.0 - David Brittain + Dash + 2.0 + Gerard Delmàs - Dash is a Mac OSX utility that can be obtained from the Apple Store - ]]> +Launches Dash with the word under the caret or the selected text.
+The default shortcut assigned in the plugin is Mac-Shift-D.
+
+Dash is a Mac OSX utility that can be obtained from the Apple Store.
+
+The plugin will use the documents file type to determine which docset keyword to use in Dash.
+These associations are customizable in "~/Library/Preferences/%IDE_NAME%/options/options.xml" under the property "DASH_PLUGIN_KEYWORDS"
+%IDE_NAME% might be "WebIde60" or "IdeaIC12"
+
+Values pairs can be provided in a semi-colon delimited list. The value pair consists of FILE_TYPE=KEYWORD
+File type names can be found in the IDE settings. Instead of file types file extensions can be used. The file extension has to start with a dot.
+
+ ex: HTML=html;.xhtml=html
+      |           |
+      |          Uses Dash keyword "html" for files with .xhtml extension (extensions have priority over file types)
+     Uses Dash keyword "html" for files of type HTML
+
+
+Initially developed by David Brittain + ]]> - ]]> +2.0 Added Dash docset keyword support
+]]>
@@ -32,7 +49,7 @@ + description="Searches word under caret in Dash"> diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 865cd78..9446155 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -6,7 +6,7 @@ public class KeywordLookup { - private static String CONFIG_KEYWORDS = "DASH_INTEGRATION_KEYWORDS"; + private static String CONFIG_KEYWORDS = "DASH_PLUGIN_KEYWORDS"; private static String DEFAULT_KEYWORDS = "ActionScript=actionscript;C++=cpp;CoffeeScriptcoffee;Perl=perl;CSS=css;Erlang=erlang;Haskell=haskell;HTML=html;JAVA=java;CLASS=java;JavaScript=javascript;LESS=less;PHP=php;SASS=sass"; private HashMap typeMap; @@ -37,11 +37,11 @@ public KeywordLookup() private void initDefaults() { /* - Associations are customizable in "~/Library/Preferences/%IDE_NAME%/options/options.xml" under the property "DASH_INTEGRATION_KEYWORDS" + Associations are customizable in "~/Library/Preferences/%IDE_NAME%/options/options.xml" under the property "DASH_PLUGIN_KEYWORDS" %IDE_NAME% might be "WebIde60" or "IdeaIC12" Values pairs can be provided in a semi-colon delimited list. The value pair consists of FILE_TYPE=KEYWORD - File type names can be found in the IDE settings. Instead of file types also file extensions can be used. The file extension has to start with a dot. + File type names can be found in the IDE settings. Instead of file types file extensions can be used. The file extension has to start with a dot. ex: HTML=html;.xhtml=html | | From 77290ab2343b564c1ffde1540e73315f0cf97d3c Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 13 Nov 2013 19:14:11 +0100 Subject: [PATCH 04/97] updated readme --- README.txt | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/README.txt b/README.txt index a6e0d32..c3d2492 100644 --- a/README.txt +++ b/README.txt @@ -1,13 +1,27 @@ -A simple plugin for AppCode (and other IntelliJ based IDEs) that provides keyboard shortcut access to Dash. This is necessary as the 'Services' menu is not populated in AppCode (apparently a Java limitation). +A simple plugin for the IntelliJ Platform (IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm and AppCode) that provides keyboard shortcut access to Dash. This is necessary as the 'Services' menu is not populated in IntelliJ (apparently a Java limitation). -Download Dash.jar from here: https://github.com/combinatorial/AppCodeDashSearch/releases/download/1.0/Dash.jar - -Install Dash.jar in this folder as a plugin. - -Dash is a Mac application for rapid search of developer documentation. It is free with nags to persuade you to pay and lose the nags. The free version is fully functional and super-useful. Get karma for buying and supporting the developer :) It can be downloaded here: +Download Dash.jar from here: https://github.com/gdelmas/IntelliJDashPlugin/releases/download/2.0/Dash.jar +Install Dash.jar as a plugin. +Dash is a Mac application for rapid search of developer documentation. It is free with nags to persuade you to pay and lose the nags. The free version is fully functional and super-useful. Get karma for buying and supporting the developer :) It can be downloaded here: http://itunes.apple.com/us/app/dash/id458034879?ls=1&mt=12 + The default shortcut assigned in the plugin is Mac-Shift-D. It either uses the current selection for the search, or the caret position. +The plugin will use the documents file type to determine which docset keyword to use in Dash. +These associations are customizable in "~/Library/Preferences/%IDE_NAME%/options/options.xml" under the property "DASH_PLUGIN_KEYWORDS" +%IDE_NAME% might be "WebIde60" or "IdeaIC12" + +Values pairs can be provided in a semi-colon delimited list. The value pair consists of FILE_TYPE=KEYWORD +File type names can be found in the IDE settings. Instead of file types file extensions can be used. The file extension has to start with a dot. + + ex: HTML=html;.xhtml=html + | | + | Uses Dash keyword "html" for files with + | .xhtml extension (extensions have + | priority over file types) + Uses Dash keyword "html" for files of type HTML + + Please feel free to request improvements, or fork-it and make them yourself! From 70a23e35feb5905a240344adea953014b534f96c Mon Sep 17 00:00:00 2001 From: Bogdan Popescu Date: Mon, 18 Nov 2013 03:31:08 +0200 Subject: [PATCH 05/97] Update README.txt --- README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.txt b/README.txt index c3d2492..c073d25 100644 --- a/README.txt +++ b/README.txt @@ -4,7 +4,7 @@ Download Dash.jar from here: https://github.com/gdelmas/IntelliJDashPlugin/relea Install Dash.jar as a plugin. Dash is a Mac application for rapid search of developer documentation. It is free with nags to persuade you to pay and lose the nags. The free version is fully functional and super-useful. Get karma for buying and supporting the developer :) It can be downloaded here: -http://itunes.apple.com/us/app/dash/id458034879?ls=1&mt=12 +http://kapeli.com/dash The default shortcut assigned in the plugin is Mac-Shift-D. It either uses the current selection for the search, or the caret position. From fb69ce31f00f68f12588a8df0d3624bbf27fd1a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delm=C3=A0s?= Date: Mon, 18 Nov 2013 02:41:42 +0100 Subject: [PATCH 06/97] changed dash download url in plugin description --- META-INF/plugin.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 03d4249..26639a1 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -8,7 +8,7 @@ Launches Dash with the word under the caret or the selected text.
The default shortcut assigned in the plugin is Mac-Shift-D.

-Dash is a Mac OSX utility that can be obtained from the Apple Store.
+Dash is a Mac OSX utility that can be obtained here.

The plugin will use the documents file type to determine which docset keyword to use in Dash.
These associations are customizable in "~/Library/Preferences/%IDE_NAME%/options/options.xml" under the property "DASH_PLUGIN_KEYWORDS"
@@ -58,4 +58,4 @@ Initially developed by David -
\ No newline at end of file + From befe78092fdd291a5296d03ce283e62dd188a2a1 Mon Sep 17 00:00:00 2001 From: Gerard Date: Sun, 24 Nov 2013 16:34:12 +0100 Subject: [PATCH 07/97] added ruby syntax support --- META-INF/plugin.xml | 3 +- .../paperetto/dash/DashLauncherAction.java | 32 +++++++++++++++---- src/de/dreamlab/dash/KeywordLookup.java | 4 +-- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 03d4249..aa157f8 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,7 +1,7 @@ com.paperetto.dash Dash - 2.0 + 2.1 Gerard Delmàs David ]]> 2.0 Added Dash docset keyword support
]]>
diff --git a/src/com/paperetto/dash/DashLauncherAction.java b/src/com/paperetto/dash/DashLauncherAction.java index fb99798..d0db7d9 100644 --- a/src/com/paperetto/dash/DashLauncherAction.java +++ b/src/com/paperetto/dash/DashLauncherAction.java @@ -18,6 +18,7 @@ public class DashLauncherAction extends AnAction { private KeywordLookup keywordLookup; + private String fileType = null; public DashLauncherAction() { @@ -34,20 +35,20 @@ public void update(AnActionEvent e) { private String getWordAtCursor(CharSequence editorText, int cursorOffset) { if(editorText.length() == 0) return null; - if(cursorOffset > 0 && !Character.isJavaIdentifierPart(editorText.charAt(cursorOffset)) && - Character.isJavaIdentifierPart(editorText.charAt(cursorOffset - 1))) { + if(cursorOffset > 0 && !isIdentifierPart(editorText.charAt(cursorOffset)) && + isIdentifierPart(editorText.charAt(cursorOffset - 1))) { cursorOffset--; } - if(Character.isJavaIdentifierPart(editorText.charAt(cursorOffset))) { + if(isIdentifierPart(editorText.charAt(cursorOffset))) { int start = cursorOffset; int end = cursorOffset; - while(start > 0 && Character.isJavaIdentifierPart(editorText.charAt(start-1))) { + while(start > 0 && isIdentifierPart(editorText.charAt(start-1))) { start--; } - while(end < editorText.length() && Character.isJavaIdentifierPart(editorText.charAt(end))) { + while(end < editorText.length() && isIdentifierPart(editorText.charAt(end))) { end++; } @@ -57,6 +58,15 @@ private String getWordAtCursor(CharSequence editorText, int cursorOffset) { } public void actionPerformed(AnActionEvent e) { + VirtualFile virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE); + + if ( virtualFile != null ) { + fileType = keywordLookup.cleanType(virtualFile.getFileType().getName()); + } + else { + fileType = null; + } + Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext()); @@ -78,11 +88,10 @@ public void actionPerformed(AnActionEvent e) { if(word!=null) { // keyword - VirtualFile virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE); String keyword = null; if ( virtualFile != null) { - keyword = keywordLookup.findKeyword(virtualFile.getFileType().getName(), virtualFile.getExtension()); + keyword = keywordLookup.findKeyword(virtualFile.getFileType().getName(), virtualFile.getExtension()); } // search word @@ -118,4 +127,13 @@ public void actionPerformed(AnActionEvent e) { } } } + + private boolean isIdentifierPart(char ch) { + if ( fileType.equalsIgnoreCase("Ruby") ) { + return Character.isJavaIdentifierPart(ch) || ch == '?'; + } + else { + return Character.isJavaIdentifierPart(ch); + } + } } diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 9446155..3104670 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -7,7 +7,7 @@ public class KeywordLookup { private static String CONFIG_KEYWORDS = "DASH_PLUGIN_KEYWORDS"; - private static String DEFAULT_KEYWORDS = "ActionScript=actionscript;C++=cpp;CoffeeScriptcoffee;Perl=perl;CSS=css;Erlang=erlang;Haskell=haskell;HTML=html;JAVA=java;CLASS=java;JavaScript=javascript;LESS=less;PHP=php;SASS=sass"; + private static String DEFAULT_KEYWORDS = "ActionScript=actionscript;C++=cpp;CoffeeScriptcoffee;Perl=perl;CSS=css;Erlang=erlang;Haskell=haskell;HTML=html;JAVA=java;CLASS=java;JavaScript=javascript;LESS=less;PHP=php;SASS=sass;Ruby=ruby"; private HashMap typeMap; private HashMap extensionMap; @@ -66,7 +66,7 @@ public String findKeyword(String type, String extension) } } - private String cleanType(String type) + public String cleanType(String type) { type = type.replaceFirst("\\(.*\\)", ""); type = type.replace("files", ""); From e84c00be564d57b74bf1bc05ef8064878e886d5f Mon Sep 17 00:00:00 2001 From: Gerard Date: Sun, 24 Nov 2013 17:06:38 +0100 Subject: [PATCH 08/97] fixed issue with lookup on empty files and on file end --- META-INF/plugin.xml | 2 +- src/com/paperetto/dash/DashLauncherAction.java | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index aa157f8..a8cbffc 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -27,7 +27,7 @@ Initially developed by
David ]]> +2.1 Added Ruby syntax support, stability fixes
2.0 Added Dash docset keyword support
]]>
diff --git a/src/com/paperetto/dash/DashLauncherAction.java b/src/com/paperetto/dash/DashLauncherAction.java index d0db7d9..935f739 100644 --- a/src/com/paperetto/dash/DashLauncherAction.java +++ b/src/com/paperetto/dash/DashLauncherAction.java @@ -34,25 +34,29 @@ public void update(AnActionEvent e) { private String getWordAtCursor(CharSequence editorText, int cursorOffset) { - if(editorText.length() == 0) return null; - if(cursorOffset > 0 && !isIdentifierPart(editorText.charAt(cursorOffset)) && - isIdentifierPart(editorText.charAt(cursorOffset - 1))) { + int editorTextLength = editorText.length(); + + if ( editorTextLength == 0 ) { + return null; + } + + if ( (cursorOffset >= editorTextLength) || (cursorOffset > 1 && !isIdentifierPart(editorText.charAt(cursorOffset) ) && isIdentifierPart(editorText.charAt(cursorOffset - 1))) ) { cursorOffset--; } - if(isIdentifierPart(editorText.charAt(cursorOffset))) { + if ( isIdentifierPart(editorText.charAt(cursorOffset)) ) { int start = cursorOffset; int end = cursorOffset; - while(start > 0 && isIdentifierPart(editorText.charAt(start-1))) { + while ( start > 0 && isIdentifierPart(editorText.charAt(start-1)) ) { start--; } - while(end < editorText.length() && isIdentifierPart(editorText.charAt(end))) { + while ( end < editorTextLength && isIdentifierPart(editorText.charAt(end)) ) { end++; } - return editorText.subSequence(start,end).toString(); + return editorText.subSequence(start, end).toString(); } return null; } From 2d9114833b00e194c0fe9aeacb529fb5b1ef4d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delm=C3=A0s?= Date: Sun, 24 Nov 2013 17:35:41 +0100 Subject: [PATCH 09/97] Update README.txt --- README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.txt b/README.txt index c073d25..eca4eb3 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -A simple plugin for the IntelliJ Platform (IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm and AppCode) that provides keyboard shortcut access to Dash. This is necessary as the 'Services' menu is not populated in IntelliJ (apparently a Java limitation). +A simple plugin for the IntelliJ Platform (IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm, Android Studio and AppCode) that provides keyboard shortcut access to Dash. This is necessary as the 'Services' menu is not populated in IntelliJ (apparently a Java limitation). Download Dash.jar from here: https://github.com/gdelmas/IntelliJDashPlugin/releases/download/2.0/Dash.jar Install Dash.jar as a plugin. From 7af235e78549b5b479ef1062d70dc88e8f6343de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delm=C3=A0s?= Date: Sun, 24 Nov 2013 19:58:39 +0100 Subject: [PATCH 10/97] Update README.txt --- README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.txt b/README.txt index eca4eb3..f415913 100644 --- a/README.txt +++ b/README.txt @@ -1,6 +1,6 @@ A simple plugin for the IntelliJ Platform (IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm, Android Studio and AppCode) that provides keyboard shortcut access to Dash. This is necessary as the 'Services' menu is not populated in IntelliJ (apparently a Java limitation). -Download Dash.jar from here: https://github.com/gdelmas/IntelliJDashPlugin/releases/download/2.0/Dash.jar +Download Dash.jar from here: https://github.com/gdelmas/IntelliJDashPlugin/releases Install Dash.jar as a plugin. Dash is a Mac application for rapid search of developer documentation. It is free with nags to persuade you to pay and lose the nags. The free version is fully functional and super-useful. Get karma for buying and supporting the developer :) It can be downloaded here: From 1e74c6ba047d612fed84dbcecc10f7b2654312be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delm=C3=A0s?= Date: Mon, 25 Nov 2013 17:08:59 +0100 Subject: [PATCH 11/97] Update and rename README.txt to README.md --- README.txt => README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) rename README.txt => README.md (79%) diff --git a/README.txt b/README.md similarity index 79% rename from README.txt rename to README.md index f415913..18e86a5 100644 --- a/README.txt +++ b/README.md @@ -1,14 +1,17 @@ A simple plugin for the IntelliJ Platform (IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm, Android Studio and AppCode) that provides keyboard shortcut access to Dash. This is necessary as the 'Services' menu is not populated in IntelliJ (apparently a Java limitation). -Download Dash.jar from here: https://github.com/gdelmas/IntelliJDashPlugin/releases -Install Dash.jar as a plugin. +## Installation +To install the plugin in your IntelliJ IDE go to Preferences -> Plugins -> Browse repositories and search for "Dash". +## Kapeli Dash Dash is a Mac application for rapid search of developer documentation. It is free with nags to persuade you to pay and lose the nags. The free version is fully functional and super-useful. Get karma for buying and supporting the developer :) It can be downloaded here: -http://kapeli.com/dash +[http://kapeli.com/dash](http://kapeli.com/dash) +## Usage +The default shortcut assigned in the plugin is **Mac-Shift-D**. It either +uses the current selection for the search, or the caret position. -The default shortcut assigned in the plugin is Mac-Shift-D. It either uses the current selection for the search, or the caret position. - +## Configuration The plugin will use the documents file type to determine which docset keyword to use in Dash. These associations are customizable in "~/Library/Preferences/%IDE_NAME%/options/options.xml" under the property "DASH_PLUGIN_KEYWORDS" %IDE_NAME% might be "WebIde60" or "IdeaIC12" From 411444b9f31efd7a92fdf8337243de94f7361708 Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Tue, 26 Nov 2013 20:23:34 +0100 Subject: [PATCH 12/97] Better defaults for Android Studio. If this plugin is configured to run under Android Studio there is no real need to have Java files use the Java docset whilst the Android docset is a much better fit (as it is a superset of Java's anyway). --- src/de/dreamlab/dash/KeywordLookup.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 3104670..f800ca2 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -1,13 +1,14 @@ package de.dreamlab.dash; import com.intellij.ide.util.PropertiesComponent; +import com.intellij.openapi.application.ApplicationInfo; import java.util.HashMap; - public class KeywordLookup { private static String CONFIG_KEYWORDS = "DASH_PLUGIN_KEYWORDS"; private static String DEFAULT_KEYWORDS = "ActionScript=actionscript;C++=cpp;CoffeeScriptcoffee;Perl=perl;CSS=css;Erlang=erlang;Haskell=haskell;HTML=html;JAVA=java;CLASS=java;JavaScript=javascript;LESS=less;PHP=php;SASS=sass;Ruby=ruby"; + private static final String ANDROID_STUDIO_PRODUCT_CODE = "AI"; private HashMap typeMap; private HashMap extensionMap; @@ -38,7 +39,7 @@ private void initDefaults() { /* Associations are customizable in "~/Library/Preferences/%IDE_NAME%/options/options.xml" under the property "DASH_PLUGIN_KEYWORDS" - %IDE_NAME% might be "WebIde60" or "IdeaIC12" + %IDE_NAME% might be "WebIde60", "IdeaIC12", or "AndroidStudioPreview". Values pairs can be provided in a semi-colon delimited list. The value pair consists of FILE_TYPE=KEYWORD File type names can be found in the IDE settings. Instead of file types file extensions can be used. The file extension has to start with a dot. @@ -52,7 +53,16 @@ private void initDefaults() PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); if ( !propertiesComponent.isValueSet(CONFIG_KEYWORDS) ) { - propertiesComponent.setValue(CONFIG_KEYWORDS, DEFAULT_KEYWORDS); + // If it's Android Studio, use the Android docset instead of Java's. + if (ANDROID_STUDIO_PRODUCT_CODE.equals( + ApplicationInfo.getInstance().getBuild().getProductCode())) { + + // Really revolting hack but it gets the job done. + propertiesComponent.setValue(CONFIG_KEYWORDS, + DEFAULT_KEYWORDS.replace("JAVA=java;", "JAVA=android;")); + } else { + propertiesComponent.setValue(CONFIG_KEYWORDS, DEFAULT_KEYWORDS); + } } } From c122c6d43443efd48ddd60fe8b9091e68e67c853 Mon Sep 17 00:00:00 2001 From: Bogdan Popescu Date: Fri, 29 Nov 2013 10:17:31 +0200 Subject: [PATCH 13/97] Fix Java keywords --- src/de/dreamlab/dash/KeywordLookup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 3104670..304c2f5 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -7,7 +7,7 @@ public class KeywordLookup { private static String CONFIG_KEYWORDS = "DASH_PLUGIN_KEYWORDS"; - private static String DEFAULT_KEYWORDS = "ActionScript=actionscript;C++=cpp;CoffeeScriptcoffee;Perl=perl;CSS=css;Erlang=erlang;Haskell=haskell;HTML=html;JAVA=java;CLASS=java;JavaScript=javascript;LESS=less;PHP=php;SASS=sass;Ruby=ruby"; + private static String DEFAULT_KEYWORDS = "ActionScript=actionscript;C++=cpp;CoffeeScript=coffee;Perl=perl;CSS=css;Erlang=erlang;Haskell=haskell;HTML=html;JAVA=java7;CLASS=java7;JavaScript=javascript;LESS=less;PHP=php;SASS=sass;Ruby=ruby"; private HashMap typeMap; private HashMap extensionMap; From 42961cbcf9c80b93bbeefc866252193045dee1cf Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Mon, 2 Dec 2013 01:34:00 +0100 Subject: [PATCH 14/97] Avoid potential NPE in isIdentifierPart. If the VirtualFile instance is null, isIdentifierPart attempts to compare fileType to the Ruby file type identifier, but the way the string comparison is executed will trigger an NPE instead of just having isIdentifierPart return false. --- .../paperetto/dash/DashLauncherAction.java | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/com/paperetto/dash/DashLauncherAction.java b/src/com/paperetto/dash/DashLauncherAction.java index 935f739..6bf6c91 100644 --- a/src/com/paperetto/dash/DashLauncherAction.java +++ b/src/com/paperetto/dash/DashLauncherAction.java @@ -6,7 +6,6 @@ import com.intellij.execution.util.ExecUtil; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.DataKeys; import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.SelectionModel; @@ -17,8 +16,11 @@ import java.net.URLEncoder; public class DashLauncherAction extends AnAction { + + private final static String RUBY_FILE_IDENTIFIER = "Ruby"; + private KeywordLookup keywordLookup; - private String fileType = null; + private String fileType; public DashLauncherAction() { @@ -63,14 +65,9 @@ private String getWordAtCursor(CharSequence editorText, int cursorOffset) { public void actionPerformed(AnActionEvent e) { VirtualFile virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE); - - if ( virtualFile != null ) { - fileType = keywordLookup.cleanType(virtualFile.getFileType().getName()); - } - else { - fileType = null; - } - + if (virtualFile != null) { + fileType = keywordLookup.cleanType(virtualFile.getFileType().getName()); + } Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext()); @@ -94,7 +91,7 @@ public void actionPerformed(AnActionEvent e) { // keyword String keyword = null; - if ( virtualFile != null) { + if (virtualFile != null) { keyword = keywordLookup.findKeyword(virtualFile.getFileType().getName(), virtualFile.getExtension()); } @@ -133,11 +130,7 @@ public void actionPerformed(AnActionEvent e) { } private boolean isIdentifierPart(char ch) { - if ( fileType.equalsIgnoreCase("Ruby") ) { - return Character.isJavaIdentifierPart(ch) || ch == '?'; - } - else { - return Character.isJavaIdentifierPart(ch); - } + return Character.isJavaIdentifierPart(ch) || + (RUBY_FILE_IDENTIFIER.equalsIgnoreCase(fileType) && ch == '?'); } } From 4ad2e493f7cd25b6a1a605be235c6e241814458c Mon Sep 17 00:00:00 2001 From: Gerard Date: Mon, 9 Dec 2013 01:13:30 +0100 Subject: [PATCH 15/97] fix conflicts from #4 --- src/de/dreamlab/dash/KeywordLookup.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 05f75a1..778d817 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -54,12 +54,9 @@ private void initDefaults() if ( !propertiesComponent.isValueSet(CONFIG_KEYWORDS) ) { // If it's Android Studio, use the Android docset instead of Java's. - if (ANDROID_STUDIO_PRODUCT_CODE.equals( - ApplicationInfo.getInstance().getBuild().getProductCode())) { - - // Really revolting hack but it gets the job done. - propertiesComponent.setValue(CONFIG_KEYWORDS, - DEFAULT_KEYWORDS.replace("JAVA=java;", "JAVA=android;")); + if (ANDROID_STUDIO_PRODUCT_CODE.equals(ApplicationInfo.getInstance().getBuild().getProductCode())) { + // Really revolting hack but it gets the job done. + propertiesComponent.setValue(CONFIG_KEYWORDS, DEFAULT_KEYWORDS.replace("JAVA=java7;", "JAVA=android;")); } else { propertiesComponent.setValue(CONFIG_KEYWORDS, DEFAULT_KEYWORDS); } From 019844e1ae93b604ae06c7497369a33e306472e9 Mon Sep 17 00:00:00 2001 From: Gerard Date: Mon, 9 Dec 2013 01:33:14 +0100 Subject: [PATCH 16/97] fixing fileType issue --- src/com/paperetto/dash/DashLauncherAction.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/com/paperetto/dash/DashLauncherAction.java b/src/com/paperetto/dash/DashLauncherAction.java index 6bf6c91..285418b 100644 --- a/src/com/paperetto/dash/DashLauncherAction.java +++ b/src/com/paperetto/dash/DashLauncherAction.java @@ -65,9 +65,14 @@ private String getWordAtCursor(CharSequence editorText, int cursorOffset) { public void actionPerformed(AnActionEvent e) { VirtualFile virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE); + if (virtualFile != null) { fileType = keywordLookup.cleanType(virtualFile.getFileType().getName()); } + else { + fileType = null; + } + Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext()); @@ -130,7 +135,11 @@ public void actionPerformed(AnActionEvent e) { } private boolean isIdentifierPart(char ch) { - return Character.isJavaIdentifierPart(ch) || - (RUBY_FILE_IDENTIFIER.equalsIgnoreCase(fileType) && ch == '?'); + if ( RUBY_FILE_IDENTIFIER.equalsIgnoreCase(fileType) ) { + return Character.isJavaIdentifierPart(ch) || ch == '?'; + } + else { + return Character.isJavaIdentifierPart(ch); + } } } From 785ca6c59bb5749e8bf94e5eba9a94b30d1c3ba6 Mon Sep 17 00:00:00 2001 From: Gerard Date: Sun, 15 Dec 2013 22:00:03 +0100 Subject: [PATCH 17/97] updated plugin description --- Dash.iml | 2 +- META-INF/plugin.xml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Dash.iml b/Dash.iml index 75cbcaa..d94fc7e 100644 --- a/Dash.iml +++ b/Dash.iml @@ -6,7 +6,7 @@ - + diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 6c3c43c..722d748 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,7 +1,7 @@ com.paperetto.dash Dash - 2.1 + 2.2 Gerard Delmàs
The plugin will use the documents file type to determine which docset keyword to use in Dash.
These associations are customizable in "~/Library/Preferences/%IDE_NAME%/options/options.xml" under the property "DASH_PLUGIN_KEYWORDS"
-%IDE_NAME% might be "WebIde60" or "IdeaIC12"
+%IDE_NAME% might be "WebIde60", "IdeaIC12" or "AndroidStudioPreview".

Values pairs can be provided in a semi-colon delimited list. The value pair consists of FILE_TYPE=KEYWORD
File type names can be found in the IDE settings. Instead of file types file extensions can be used. The file extension has to start with a dot.
@@ -27,6 +27,7 @@ Initially developed by
David ]]> 2.1 Added Ruby syntax support, stability fixes
2.0 Added Dash docset keyword support
]]> From 579ff39e813e81ee515827b4eb621543dc4d9edd Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 29 Jan 2014 18:24:48 +0100 Subject: [PATCH 18/97] updated readme to address issue #13 --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 18e86a5..e420cad 100644 --- a/README.md +++ b/README.md @@ -26,5 +26,7 @@ File type names can be found in the IDE settings. Instead of file types file ext | priority over file types) Uses Dash keyword "html" for files of type HTML +## Troubleshooting +######The installation from the repositories does not work +It looks like there is an IntelliJ/Java bug with OS X Mavericks which prevents to install plugins from the repositories. Please install the plugin manually from [here](https://github.com/gdelmas/IntelliJDashPlugin/releases). For additional information check [issue #13](https://github.com/gdelmas/IntelliJDashPlugin/issues/13). -Please feel free to request improvements, or fork-it and make them yourself! From 2260f5e067a85d468838fc810860535b59c075f7 Mon Sep 17 00:00:00 2001 From: Gerard Date: Sat, 5 Apr 2014 18:51:27 +0200 Subject: [PATCH 19/97] context sensitive search --- META-INF/plugin.xml | 21 +-- .../paperetto/dash/DashLauncherAction.java | 145 ------------------ src/de/dreamlab/dash/DashLauncher.java | 75 +++++++++ src/de/dreamlab/dash/DashLauncherAction.java | 126 +++++++++++++++ src/de/dreamlab/dash/KeywordLookup.java | 127 ++++++++------- 5 files changed, 279 insertions(+), 215 deletions(-) delete mode 100644 src/com/paperetto/dash/DashLauncherAction.java create mode 100644 src/de/dreamlab/dash/DashLauncher.java create mode 100644 src/de/dreamlab/dash/DashLauncherAction.java diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 722d748..ba4aaba 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,7 +1,7 @@ com.paperetto.dash Dash - 2.2 + 3.0 beta 1 Gerard Delmàs
Dash is a Mac OSX utility that can be obtained
here.

-The plugin will use the documents file type to determine which docset keyword to use in Dash.
-These associations are customizable in "~/Library/Preferences/%IDE_NAME%/options/options.xml" under the property "DASH_PLUGIN_KEYWORDS"
-%IDE_NAME% might be "WebIde60", "IdeaIC12" or "AndroidStudioPreview".
-
-Values pairs can be provided in a semi-colon delimited list. The value pair consists of FILE_TYPE=KEYWORD
-File type names can be found in the IDE settings. Instead of file types file extensions can be used. The file extension has to start with a dot.
-
- ex: HTML=html;.xhtml=html
-      |           |
-      |          Uses Dash keyword "html" for files with .xhtml extension (extensions have priority over file types)
-     Uses Dash keyword "html" for files of type HTML
-
-
-Initially developed by David Brittain +The plugin will identify the currently used programming language through context and request filtered search results accordingly. ]]> 2.2 Compatibility and stability fixes
2.1 Added Ruby syntax support, stability fixes
2.0 Added Dash docset keyword support
@@ -50,8 +38,7 @@ Initially developed by David - + diff --git a/src/com/paperetto/dash/DashLauncherAction.java b/src/com/paperetto/dash/DashLauncherAction.java deleted file mode 100644 index 285418b..0000000 --- a/src/com/paperetto/dash/DashLauncherAction.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.paperetto.dash; - - -import com.intellij.execution.ExecutionException; -import com.intellij.execution.configurations.GeneralCommandLine; -import com.intellij.execution.util.ExecUtil; -import com.intellij.openapi.actionSystem.AnAction; -import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.PlatformDataKeys; -import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.editor.SelectionModel; -import com.intellij.openapi.vfs.VirtualFile; -import de.dreamlab.dash.KeywordLookup; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; - -public class DashLauncherAction extends AnAction { - - private final static String RUBY_FILE_IDENTIFIER = "Ruby"; - - private KeywordLookup keywordLookup; - private String fileType; - - public DashLauncherAction() - { - keywordLookup = new KeywordLookup(); - } - - - @Override - public void update(AnActionEvent e) { - e.getPresentation().setEnabled(PlatformDataKeys.EDITOR.getData(e.getDataContext()) != null); - } - - - - private String getWordAtCursor(CharSequence editorText, int cursorOffset) { - int editorTextLength = editorText.length(); - - if ( editorTextLength == 0 ) { - return null; - } - - if ( (cursorOffset >= editorTextLength) || (cursorOffset > 1 && !isIdentifierPart(editorText.charAt(cursorOffset) ) && isIdentifierPart(editorText.charAt(cursorOffset - 1))) ) { - cursorOffset--; - } - - if ( isIdentifierPart(editorText.charAt(cursorOffset)) ) { - int start = cursorOffset; - int end = cursorOffset; - - while ( start > 0 && isIdentifierPart(editorText.charAt(start-1)) ) { - start--; - } - - while ( end < editorTextLength && isIdentifierPart(editorText.charAt(end)) ) { - end++; - } - - return editorText.subSequence(start, end).toString(); - } - return null; - } - - public void actionPerformed(AnActionEvent e) { - VirtualFile virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE); - - if (virtualFile != null) { - fileType = keywordLookup.cleanType(virtualFile.getFileType().getName()); - } - else { - fileType = null; - } - - - Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext()); - - //Editor editor = DataKeys.EDITOR.getData(e.getDataContext()); - int offset = editor.getCaretModel().getOffset(); - CharSequence editorText = editor.getDocument().getCharsSequence(); - - String word = null; - - SelectionModel selectionModel = editor.getSelectionModel(); - if(selectionModel.hasSelection()) - { - word = selectionModel.getSelectedText(); - } - else - { - word = getWordAtCursor(editorText,offset); - } - - if(word!=null) { - // keyword - String keyword = null; - - if (virtualFile != null) { - keyword = keywordLookup.findKeyword(virtualFile.getFileType().getName(), virtualFile.getExtension()); - } - - // search word - String searchWord; - try { - searchWord = URLEncoder.encode(word, "UTF-8"); - } catch (UnsupportedEncodingException el){ - ///where do I print an error - return; - } - //URLEncoder turns spaces in to '+' we need them to be %20 - searchWord = searchWord.replace("+", "%20"); - - String request = "dash://"; - - if ( keyword != null ) { - request += keyword + ":"; - } - - request += searchWord; - - //now open the URL with the 'open' command - String[] command = new String[]{ExecUtil.getOpenCommandPath()}; - try { - final GeneralCommandLine commandLine = new GeneralCommandLine(command); - commandLine.addParameter(request); - commandLine.createProcess(); - - } - catch (ExecutionException ee) { - ///where do I print an error - return; - } - } - } - - private boolean isIdentifierPart(char ch) { - if ( RUBY_FILE_IDENTIFIER.equalsIgnoreCase(fileType) ) { - return Character.isJavaIdentifierPart(ch) || ch == '?'; - } - else { - return Character.isJavaIdentifierPart(ch); - } - } -} diff --git a/src/de/dreamlab/dash/DashLauncher.java b/src/de/dreamlab/dash/DashLauncher.java new file mode 100644 index 0000000..a7a84c4 --- /dev/null +++ b/src/de/dreamlab/dash/DashLauncher.java @@ -0,0 +1,75 @@ +/** + * Created by gerard on 04.04.14. + */ + +package de.dreamlab.dash; + +import com.intellij.execution.ExecutionException; +import com.intellij.execution.configurations.GeneralCommandLine; +import com.intellij.execution.util.ExecUtil; +import com.intellij.notification.Notification; +import com.intellij.notification.NotificationType; +import com.intellij.notification.Notifications; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.Collection; + +public class DashLauncher { + + public DashLauncher() { + } + + public void search(Collection keywords, String query) + { + try { + String request = "dash-plugin://"; + + // keywords + if (keywords.size() > 0) { + request += "keys="; + int i = 0; + + for (String keyword : keywords) { + if (i > 0) { + request += ','; + } + + request += urlEncode(keyword); + + i++; + } + + request += "&"; + } + + // query + request += "query=" + urlEncode(query); + + openUri(request); + } + catch ( UnsupportedEncodingException e ) { + Notifications.Bus.notify(new Notification("Dash Plugin Error", "Dash Plugin Error", e.getMessage(), NotificationType.ERROR)); + return; + } + } + + private void openUri(String uri) + { + try { + final GeneralCommandLine commandLine = new GeneralCommandLine(ExecUtil.getOpenCommandPath()); + commandLine.addParameter(uri); + commandLine.createProcess(); + + } + catch ( ExecutionException e ) { + Notifications.Bus.notify(new Notification("Dash Plugin Error", "Dash Plugin Error", e.getMessage(), NotificationType.ERROR)); + return; + } + } + + private String urlEncode(String s) throws UnsupportedEncodingException + { + return URLEncoder.encode(s, "UTF-8").replace("+", "%20"); + } +} \ No newline at end of file diff --git a/src/de/dreamlab/dash/DashLauncherAction.java b/src/de/dreamlab/dash/DashLauncherAction.java new file mode 100644 index 0000000..6d15483 --- /dev/null +++ b/src/de/dreamlab/dash/DashLauncherAction.java @@ -0,0 +1,126 @@ +package de.dreamlab.dash; + + +import com.intellij.lang.Language; +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.LangDataKeys; +import com.intellij.openapi.actionSystem.PlatformDataKeys; +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.editor.SelectionModel; +import com.intellij.openapi.wm.impl.status.StatusBarUtil; +import com.intellij.psi.PsiComment; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; +import de.dreamlab.dash.DashLauncher; +import de.dreamlab.dash.KeywordLookup; + +public class DashLauncherAction extends AnAction { + private KeywordLookup keywordLookup; + private DashLauncher dashLauncher; + + public DashLauncherAction() + { + keywordLookup = new KeywordLookup(); + dashLauncher = new DashLauncher(); + } + + @Override + public void update(AnActionEvent e) { + e.getPresentation().setEnabled(PlatformDataKeys.EDITOR.getData(e.getDataContext()) != null); + } + + public void actionPerformed(AnActionEvent e) { + Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext()); + + PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE); + PsiElement psiElement = psiFile.findElementAt(editor.getCaretModel().getOffset()); + Language language = elementLanguage(psiElement); + + String query = null; + + SelectionModel selectionModel = editor.getSelectionModel(); + if ( selectionModel.hasSelection() ) { + query = selectionModel.getSelectedText(); + } + else { + if ( psiElement == null || psiElement instanceof PsiComment ) { + query = getWordAtCursor(editor); + } + else { + query = psiElement.getText(); + } + } + + if ( query != null ) { + // TODO remove debug message + if ( language != null ) { + String resolvedLanguage = keywordLookup.findLanguageName(language); + String message = "Searching Dash docsets with language: " + language.getID(); + + if ( !language.getID().equals(resolvedLanguage) ) { + if ( resolvedLanguage == null ) { + resolvedLanguage = "*"; + } + + message += " (resolved to: " + resolvedLanguage + ")"; + } + + StatusBarUtil.setStatusBarInfo(e.getProject(), message); + } + + dashLauncher.search(keywordLookup.findKeywords(language), query); + } + } + + private Language elementLanguage(PsiElement element) + { + if ( element == null ) { + return null; + } + + if ( element.getLanguage().getID() == "XML" ) { + PsiElement parent = element.getParent(); + + if ( parent.getLanguage().getID() != "XML" && parent.getLanguage().getBaseLanguage().getID() == "XML" ) { + return parent.getLanguage(); + } + } + + return element.getLanguage(); + } + + private String getWordAtCursor(Editor editor) { + CharSequence editorText = editor.getDocument().getCharsSequence(); + int cursorOffset = editor.getCaretModel().getOffset(); + int editorTextLength = editorText.length(); + + if ( editorTextLength == 0 ) { + return null; + } + + if ( (cursorOffset >= editorTextLength) || (cursorOffset > 1 && !isIdentifierPart(editorText.charAt(cursorOffset) ) && isIdentifierPart(editorText.charAt(cursorOffset - 1))) ) { + cursorOffset--; + } + + if ( isIdentifierPart(editorText.charAt(cursorOffset)) ) { + int start = cursorOffset; + int end = cursorOffset; + + while ( start > 0 && isIdentifierPart(editorText.charAt(start-1)) ) { + start--; + } + + while ( end < editorTextLength && isIdentifierPart(editorText.charAt(end)) ) { + end++; + } + + return editorText.subSequence(start, end).toString(); + } + return null; + } + + private boolean isIdentifierPart(char ch) { + return Character.isJavaIdentifierPart(ch); + } +} diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 778d817..8c24fbe 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -1,84 +1,105 @@ package de.dreamlab.dash; -import com.intellij.ide.util.PropertiesComponent; +import com.intellij.lang.Language; +import com.intellij.notification.Notification; +import com.intellij.notification.NotificationType; +import com.intellij.notification.Notifications; import com.intellij.openapi.application.ApplicationInfo; +import com.intellij.openapi.ui.Messages; -import java.util.HashMap; +import java.util.*; public class KeywordLookup { - private static String CONFIG_KEYWORDS = "DASH_PLUGIN_KEYWORDS"; - private static String DEFAULT_KEYWORDS = "ActionScript=actionscript;C++=cpp;CoffeeScript=coffee;Perl=perl;CSS=css;Erlang=erlang;Haskell=haskell;HTML=html;JAVA=java7;CLASS=java7;JavaScript=javascript;LESS=less;PHP=php;SASS=sass;Ruby=ruby"; private static final String ANDROID_STUDIO_PRODUCT_CODE = "AI"; - private HashMap typeMap; - private HashMap extensionMap; + private HashMap> languageMap; public KeywordLookup() { - initDefaults(); - - extensionMap = new HashMap(); - typeMap = new HashMap(); - - String[] associations = PropertiesComponent.getInstance().getValue(CONFIG_KEYWORDS).split(";"); - for ( String association : associations ) { - String[] values = association.split("="); - - if ( values.length == 2 ) { - if ( values[0].substring(0, 1).equals(".") ) { - extensionMap.put(values[0].substring(1), values[1]); - } - else { - typeMap.put(values[0], values[1]); - } - } - } - } + languageMap = new HashMap>(); + + // IntelliJ + addLanguage("JAVA", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing"); + + // WebStorm + addLanguage("HTML", "html"); + addLanguage("CSS", "css"); + addLanguage("LESS", "less", "css"); + addLanguage("SASS", "sass", "compass", "bourbon", "neat", "css"); + addLanguage("SCSS", "sass", "compass", "bourbon", "neat", "css"); + addLanguage("JavaScript", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "chai", "cordova", "phonegap"); + addLanguage("CoffeeScript", "coffee", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "chai", "cordova", "phonegap"); + addLanguage("MySQL", "mysql"); + addLanguage("SQLite", "sqlite"); + + // PhpStorm + addLanguage("PHP", "php", "wordpress", "drupal", "zend", "laravel", "yii", "joomla", "ee", "codeigniter", "cakephp", "symfony", "typo3", "twig", "smarty"); + addLanguage("SmartyConfig", "smarty"); - private void initDefaults() - { /* - Associations are customizable in "~/Library/Preferences/%IDE_NAME%/options/options.xml" under the property "DASH_PLUGIN_KEYWORDS" - %IDE_NAME% might be "WebIde60", "IdeaIC12", or "AndroidStudioPreview". + Supported Languages + + IntelliJ Community Editon: + JQL DTD SPI Properties TEXT RegExp RELAX-NG XHTML YouTrack XPath2 XPath XML Renderscript Manifest Groovy AIDL + + PhpStorm: + CSS Asp Twig RegExp JSP PostgreSQL Apple JS SQL92 ReST MySQL SQLite SmartyConfig HAML H2 DB2 GWT JavaScript TypeScript SASS XML JS in HTML JavaScript 1.8 Smarty PostgresPLSQL JQL LESS OracleSqlPlus yaml HSQLDB CoffeeScript ApacheConfig DTD JSON textmate JavaScript 1.5 Sybase Locale ECMA Script Level 4 ECMAScript 6 JavaScript 1.7 Gherkin Derby TEXT XHTML SCSS PHP XPath XPath2 RELAX-NG JavaScript 1.6 SQL YouTrack TSQL JQuery-CSS Ini JavaScript Oracle JSPX GenericSQL HTML - Values pairs can be provided in a semi-colon delimited list. The value pair consists of FILE_TYPE=KEYWORD - File type names can be found in the IDE settings. Instead of file types file extensions can be used. The file extension has to start with a dot. - ex: HTML=html;.xhtml=html - | | - | Uses Dash keyword "html" for files with .xhtml extension (extensions have priority over file types) - Uses Dash keyword "html" for files of type HTML + showRegisteredLanguages(); */ + } + + + private void showRegisteredLanguages() { + Collection languages = Language.getRegisteredLanguages(); + + String message = ""; + + for ( Language language : languages ) { + message += language.getID() + "\n"; + } - PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); + Notifications.Bus.notify(new Notification("Dash", "Dash: Registered Languages ", message, NotificationType.INFORMATION)); + } + + private void addLanguage(String language, String... keywords) + { + languageMap.put(language, Arrays.asList(keywords)); + } - if ( !propertiesComponent.isValueSet(CONFIG_KEYWORDS) ) { - // If it's Android Studio, use the Android docset instead of Java's. - if (ANDROID_STUDIO_PRODUCT_CODE.equals(ApplicationInfo.getInstance().getBuild().getProductCode())) { - // Really revolting hack but it gets the job done. - propertiesComponent.setValue(CONFIG_KEYWORDS, DEFAULT_KEYWORDS.replace("JAVA=java7;", "JAVA=android;")); - } else { - propertiesComponent.setValue(CONFIG_KEYWORDS, DEFAULT_KEYWORDS); + public String findLanguageName(Language language) + { + while ( language != null ) { + if ( languageMap.containsKey(language.getID()) ) { + return language.getID(); } + + language = language.getBaseLanguage(); } + + return null; } - public String findKeyword(String type, String extension) + public List findKeywords(Language language) { - if ( extensionMap.containsKey(extension) ) { - return extensionMap.get(extension); + String languageName = findLanguageName(language); + + if ( languageName != null ) { + return languageMap.get(languageName); } else { - return typeMap.get(cleanType(type)); + return new ArrayList(); } } - public String cleanType(String type) + private String javaKeyword() { - type = type.replaceFirst("\\(.*\\)", ""); - type = type.replace("files", ""); - type = type.trim(); - - return type; + if ( ANDROID_STUDIO_PRODUCT_CODE.equals(ApplicationInfo.getInstance().getBuild().getProductCode()) ) { + return "android"; + } + else { + return "java"; + } } } From 4b76fef453f6fb6138d83c114081660ed9c65b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delm=C3=A0s?= Date: Sat, 5 Apr 2014 19:31:57 +0200 Subject: [PATCH 20/97] added beta notes to readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index e420cad..75ead50 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ A simple plugin for the IntelliJ Platform (IntelliJ IDEA, RubyMine, WebStorm, Ph ## Installation To install the plugin in your IntelliJ IDE go to Preferences -> Plugins -> Browse repositories and search for "Dash". +## 3.0 Beta +There is a beta for version 3.0 with content aware search. You can install it manually from [here](https://github.com/gdelmas/IntelliJDashPlugin/releases/tag/3.0beta1). You can also help [create and update the search filter dictionaries](https://github.com/gdelmas/IntelliJDashPlugin/issues/15). + ## Kapeli Dash Dash is a Mac application for rapid search of developer documentation. It is free with nags to persuade you to pay and lose the nags. The free version is fully functional and super-useful. Get karma for buying and supporting the developer :) It can be downloaded here: [http://kapeli.com/dash](http://kapeli.com/dash) From aecf235bafaa8ba666531c42c4754b51935a58aa Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 23 Apr 2014 23:32:13 +0200 Subject: [PATCH 21/97] better language context list debug output needed in development for keyword to context mapping --- src/de/dreamlab/dash/KeywordLookup.java | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 8c24fbe..d26f181 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -46,18 +46,35 @@ public KeywordLookup() CSS Asp Twig RegExp JSP PostgreSQL Apple JS SQL92 ReST MySQL SQLite SmartyConfig HAML H2 DB2 GWT JavaScript TypeScript SASS XML JS in HTML JavaScript 1.8 Smarty PostgresPLSQL JQL LESS OracleSqlPlus yaml HSQLDB CoffeeScript ApacheConfig DTD JSON textmate JavaScript 1.5 Sybase Locale ECMA Script Level 4 ECMAScript 6 JavaScript 1.7 Gherkin Derby TEXT XHTML SCSS PHP XPath XPath2 RELAX-NG JavaScript 1.6 SQL YouTrack TSQL JQuery-CSS Ini JavaScript Oracle JSPX GenericSQL HTML - showRegisteredLanguages(); + /* + use the following command to display all available languages in the event log. intended for development purposes. + listRegisteredLanguages(); */ } - private void showRegisteredLanguages() { + private void listRegisteredLanguages() { Collection languages = Language.getRegisteredLanguages(); - String message = ""; + ArrayList languageList = new ArrayList(); for ( Language language : languages ) { - message += language.getID() + "\n"; + String languageStr = language.getID(); + + Language baseLanguage = language.getBaseLanguage(); + while ( baseLanguage != null ) { + languageStr += " <- " + baseLanguage.getID(); + baseLanguage = baseLanguage.getBaseLanguage(); + } + + languageList.add(languageStr); + } + + Collections.sort(languageList); + + String message = ""; + for ( String s : languageList ) { + message += s + "\n"; } Notifications.Bus.notify(new Notification("Dash", "Dash: Registered Languages ", message, NotificationType.INFORMATION)); From 5b89d633917ffb63fbc90bc8396fac575edcc252 Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 23 Apr 2014 23:34:50 +0200 Subject: [PATCH 22/97] context to keyword mapping for all intellij idea ide's --- src/de/dreamlab/dash/KeywordLookup.java | 50 +++++++++++++++---------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index d26f181..66d1f20 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -18,32 +18,44 @@ public KeywordLookup() { languageMap = new HashMap>(); - // IntelliJ - addLanguage("JAVA", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing"); - - // WebStorm + // IntelliJ Community Edition 13.1, WebStorm 8.0, PhpStorm 7.1, RubyMine 6.3, PyCharm 3.1 addLanguage("HTML", "html"); + addLanguage("XHTML", "html"); + addLanguage("XML", "xml"); + addLanguage("XPath", "xml"); // not RubyMine, not PyCharm + addLanguage("RegExp", "regex"); + + // WebStorm 8.0, PhpStorm 7.1, RubyMine 6.3, PyCharm 3.1 addLanguage("CSS", "css"); + addLanguage("JQuery-CSS", "css", "jquery", "jqueryui", "jquerym"); addLanguage("LESS", "less", "css"); addLanguage("SASS", "sass", "compass", "bourbon", "neat", "css"); addLanguage("SCSS", "sass", "compass", "bourbon", "neat", "css"); - addLanguage("JavaScript", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "chai", "cordova", "phonegap"); + addLanguage("Stylus", "stylus", "css"); // not PhpStorm + addLanguage("HAML", "haml"); addLanguage("CoffeeScript", "coffee", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "chai", "cordova", "phonegap"); - addLanguage("MySQL", "mysql"); - addLanguage("SQLite", "sqlite"); - - // PhpStorm - addLanguage("PHP", "php", "wordpress", "drupal", "zend", "laravel", "yii", "joomla", "ee", "codeigniter", "cakephp", "symfony", "typo3", "twig", "smarty"); - addLanguage("SmartyConfig", "smarty"); - - /* - Supported Languages - - IntelliJ Community Editon: - JQL DTD SPI Properties TEXT RegExp RELAX-NG XHTML YouTrack XPath2 XPath XML Renderscript Manifest Groovy AIDL + addLanguage("JavaScript", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "chai", "cordova", "phonegap"); + addLanguage("MySQL", "mysql"); // not WebStorm + addLanguage("SQLite", "sqlite"); // not WebStorm - PhpStorm: - CSS Asp Twig RegExp JSP PostgreSQL Apple JS SQL92 ReST MySQL SQLite SmartyConfig HAML H2 DB2 GWT JavaScript TypeScript SASS XML JS in HTML JavaScript 1.8 Smarty PostgresPLSQL JQL LESS OracleSqlPlus yaml HSQLDB CoffeeScript ApacheConfig DTD JSON textmate JavaScript 1.5 Sybase Locale ECMA Script Level 4 ECMAScript 6 JavaScript 1.7 Gherkin Derby TEXT XHTML SCSS PHP XPath XPath2 RELAX-NG JavaScript 1.6 SQL YouTrack TSQL JQuery-CSS Ini JavaScript Oracle JSPX GenericSQL HTML + // IntelliJ Community Edition 13.1 + addLanguage("JAVA", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing"); + addLanguage("JSP", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing"); // uncertain + addLanguage("JSPX", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing"); // uncertain + + // Products listed for each entry + addLanguage("Dart", "dartlang"); // WebStorm (not yet supported by Dash) + addLanguage("DjangoTemplate", "django"); // PyCharm + addLanguage("Groovy", "groovy"); // IntelliJ + addLanguage("Puppet", "puppet"); // RubyMine, PyCharm + addLanguage("Jade", "jade"); // WebStorm + addLanguage("JsInJade", "javascript", "jade"); // WebStorm + addLanguage("Markdown", "markdown"); // PhpStorm + addLanguage("PHP", "php", "wordpress", "drupal", "zend", "laravel", "yii", "joomla", "ee", "codeigniter", "cakephp", "symfony", "typo3", "twig", "smarty"); // PhpStorm + addLanguage("Python", "python", "django", "twisted", "sphinx", "flask", "cvp"); // PyCharm + addLanguage("Smarty", "smarty"); // PhpStorm + addLanguage("SmartyConfig", "smarty"); // PhpStorm + addLanguage("Twig", "twig"); // PhpStorm /* From a62fb774fb942e3ae69d02a7c1fa493c29f166c8 Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 23 Apr 2014 23:39:50 +0200 Subject: [PATCH 23/97] human readable status message for potential troubleshooting --- src/de/dreamlab/dash/DashLauncherAction.java | 26 +++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/de/dreamlab/dash/DashLauncherAction.java b/src/de/dreamlab/dash/DashLauncherAction.java index 6d15483..0b42132 100644 --- a/src/de/dreamlab/dash/DashLauncherAction.java +++ b/src/de/dreamlab/dash/DashLauncherAction.java @@ -53,22 +53,24 @@ public void actionPerformed(AnActionEvent e) { } if ( query != null ) { - // TODO remove debug message - if ( language != null ) { - String resolvedLanguage = keywordLookup.findLanguageName(language); - String message = "Searching Dash docsets with language: " + language.getID(); + // show status message for potential troubleshooting + String resolvedLanguage = keywordLookup.findLanguageName(language); - if ( !language.getID().equals(resolvedLanguage) ) { - if ( resolvedLanguage == null ) { - resolvedLanguage = "*"; - } - - message += " (resolved to: " + resolvedLanguage + ")"; - } + String message; + if ( resolvedLanguage == null ) { + message = "Searching all docsets in Dash"; + } + else { + message = "Searching \"" + resolvedLanguage + "\" docsets in Dash"; + } - StatusBarUtil.setStatusBarInfo(e.getProject(), message); + if ( !language.getID().equals(resolvedLanguage) ) { + message += ". Based on \"" + language.getID() + "\" context"; } + StatusBarUtil.setStatusBarInfo(e.getProject(), message); + + // open dash dashLauncher.search(keywordLookup.findKeywords(language), query); } } From e8685f989f9cb28e89c76de70b483a06aca32384 Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 23 Apr 2014 23:49:28 +0200 Subject: [PATCH 24/97] updated version and description --- META-INF/plugin.xml | 2 +- README.md | 27 ++++----------------------- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index ba4aaba..3b226d4 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,7 +1,7 @@ com.paperetto.dash Dash - 3.0 beta 1 + 3.0 Gerard Delmàs Plugins -> Browse repositories and search for "Dash". -## 3.0 Beta -There is a beta for version 3.0 with content aware search. You can install it manually from [here](https://github.com/gdelmas/IntelliJDashPlugin/releases/tag/3.0beta1). You can also help [create and update the search filter dictionaries](https://github.com/gdelmas/IntelliJDashPlugin/issues/15). - ## Kapeli Dash Dash is a Mac application for rapid search of developer documentation. It is free with nags to persuade you to pay and lose the nags. The free version is fully functional and super-useful. Get karma for buying and supporting the developer :) It can be downloaded here: [http://kapeli.com/dash](http://kapeli.com/dash) ## Usage -The default shortcut assigned in the plugin is **Mac-Shift-D**. It either -uses the current selection for the search, or the caret position. - -## Configuration -The plugin will use the documents file type to determine which docset keyword to use in Dash. -These associations are customizable in "~/Library/Preferences/%IDE_NAME%/options/options.xml" under the property "DASH_PLUGIN_KEYWORDS" -%IDE_NAME% might be "WebIde60" or "IdeaIC12" - -Values pairs can be provided in a semi-colon delimited list. The value pair consists of FILE_TYPE=KEYWORD -File type names can be found in the IDE settings. Instead of file types file extensions can be used. The file extension has to start with a dot. - - ex: HTML=html;.xhtml=html - | | - | Uses Dash keyword "html" for files with - | .xhtml extension (extensions have - | priority over file types) - Uses Dash keyword "html" for files of type HTML +The default shortcut assigned in the plugin is **Mac-Shift-D**. +It either uses the current selection for the search, or the caret position. The plugin will identify the currently used programming language through context and request filtered search results accordingly. ## Troubleshooting ######The installation from the repositories does not work -It looks like there is an IntelliJ/Java bug with OS X Mavericks which prevents to install plugins from the repositories. Please install the plugin manually from [here](https://github.com/gdelmas/IntelliJDashPlugin/releases). For additional information check [issue #13](https://github.com/gdelmas/IntelliJDashPlugin/issues/13). - +It looks like there is an IntelliJ/Java bug with OS X Mavericks which prevents to install plugins from the repositories. Please install the plugin manually from [here](https://github.com/gdelmas/IntelliJDashPlugin/releases). For additional information check [issue #13](https://github.com/gdelmas/IntelliJDashPlugin/issues/13). \ No newline at end of file From 1b6e7ba7847a2350caf9e73bfa3c74906d579758 Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 25 Apr 2014 00:32:08 +0200 Subject: [PATCH 25/97] added missing ruby mapping --- src/de/dreamlab/dash/KeywordLookup.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 66d1f20..b04053b 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -53,6 +53,7 @@ public KeywordLookup() addLanguage("Markdown", "markdown"); // PhpStorm addLanguage("PHP", "php", "wordpress", "drupal", "zend", "laravel", "yii", "joomla", "ee", "codeigniter", "cakephp", "symfony", "typo3", "twig", "smarty"); // PhpStorm addLanguage("Python", "python", "django", "twisted", "sphinx", "flask", "cvp"); // PyCharm + addLanguage("ruby", "ruby", "rubygems", "rails"); // RubyMine addLanguage("Smarty", "smarty"); // PhpStorm addLanguage("SmartyConfig", "smarty"); // PhpStorm addLanguage("Twig", "twig"); // PhpStorm From abb45cfa2254920bd150826b99be09757f8e8ae4 Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 25 Apr 2014 00:33:45 +0200 Subject: [PATCH 26/97] changed version number and release notes --- META-INF/plugin.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 3b226d4..4807ac7 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -14,10 +14,11 @@ The plugin will identify the currently used programming language through context ]]> -2.2 Compatibility and stability fixes
-2.1 Added Ruby syntax support, stability fixes
-2.0 Added Dash docset keyword support
+3.0.1 Fixed missing Ruby context recognition
+3.0 Added Context aware search
+2.2 Compatibility and stability fixes
+2.1 Added Ruby syntax support, stability fixes
+2.0 Added Dash docset keyword support
]]>
From 91e2cf1e76e182396d8d5fc6128fc54fe90d802b Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 25 Apr 2014 00:33:45 +0200 Subject: [PATCH 27/97] changed version number and release notes --- META-INF/plugin.xml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 3b226d4..f154b84 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,7 +1,7 @@ com.paperetto.dash Dash - 3.0 + 3.0.1 Gerard Delmàs -2.2 Compatibility and stability fixes
-2.1 Added Ruby syntax support, stability fixes
-2.0 Added Dash docset keyword support
+3.0.1 Fixed missing Ruby context recognition
+3.0 Added Context aware search
+2.2 Compatibility and stability fixes
+2.1 Added Ruby syntax support, stability fixes
+2.0 Added Dash docset keyword support
]]>
From 3d1223cd18161dfd680ae229c362944943d161e7 Mon Sep 17 00:00:00 2001 From: Gerard Date: Thu, 1 May 2014 17:51:14 +0200 Subject: [PATCH 28/97] avoid potential NPE --- src/de/dreamlab/dash/DashLauncherAction.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/de/dreamlab/dash/DashLauncherAction.java b/src/de/dreamlab/dash/DashLauncherAction.java index 0b42132..dbfb713 100644 --- a/src/de/dreamlab/dash/DashLauncherAction.java +++ b/src/de/dreamlab/dash/DashLauncherAction.java @@ -34,8 +34,13 @@ public void actionPerformed(AnActionEvent e) { Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext()); PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE); - PsiElement psiElement = psiFile.findElementAt(editor.getCaretModel().getOffset()); - Language language = elementLanguage(psiElement); + PsiElement psiElement; + Language language; + + if ( psiFile != null ) { + psiElement = psiFile.findElementAt(editor.getCaretModel().getOffset()); + language = elementLanguage(psiElement); + } String query = null; From d594c1045396fe803a45f12caabc8f0f9ced7362 Mon Sep 17 00:00:00 2001 From: Gerard Date: Tue, 6 May 2014 18:15:51 +0200 Subject: [PATCH 29/97] fixed string comparisons & var initializations --- src/de/dreamlab/dash/DashLauncherAction.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/de/dreamlab/dash/DashLauncherAction.java b/src/de/dreamlab/dash/DashLauncherAction.java index dbfb713..fa00351 100644 --- a/src/de/dreamlab/dash/DashLauncherAction.java +++ b/src/de/dreamlab/dash/DashLauncherAction.java @@ -12,10 +12,10 @@ import com.intellij.psi.PsiComment; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; -import de.dreamlab.dash.DashLauncher; -import de.dreamlab.dash.KeywordLookup; public class DashLauncherAction extends AnAction { + private static final String XML_LANGUAGE_ID = "XML"; + private KeywordLookup keywordLookup; private DashLauncher dashLauncher; @@ -34,8 +34,8 @@ public void actionPerformed(AnActionEvent e) { Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext()); PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE); - PsiElement psiElement; - Language language; + PsiElement psiElement = null; + Language language = null; if ( psiFile != null ) { psiElement = psiFile.findElementAt(editor.getCaretModel().getOffset()); @@ -86,10 +86,10 @@ private Language elementLanguage(PsiElement element) return null; } - if ( element.getLanguage().getID() == "XML" ) { + if ( XML_LANGUAGE_ID.equals(element.getLanguage().getID()) ) { PsiElement parent = element.getParent(); - if ( parent.getLanguage().getID() != "XML" && parent.getLanguage().getBaseLanguage().getID() == "XML" ) { + if ( !XML_LANGUAGE_ID.equals(parent.getLanguage().getID()) && XML_LANGUAGE_ID.equals(parent.getLanguage().getBaseLanguage().getID()) ) { return parent.getLanguage(); } } From 119b0e805045887cacb3475a3059ad7f02945255 Mon Sep 17 00:00:00 2001 From: Gerard Date: Tue, 6 May 2014 18:33:47 +0200 Subject: [PATCH 30/97] updated .gitignore --- .gitignore | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 496ee2c..1ac4749 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,73 @@ -.DS_Store \ No newline at end of file +# Created by http://www.gitignore.io + +### OSX ### +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear on external disk +.Spotlight-V100 +.Trashes + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + + +### Xcode ### +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.xcuserstate + + +### AppCode ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm + +## Directory-based project format +.idea/ +# if you remove the above rule, at least ignore user-specific stuff: +# .idea/workspace.xml +# .idea/tasks.xml +# and these sensitive or high-churn files: +# .idea/dataSources.ids +# .idea/dataSources.xml +# .idea/sqlDataSources.xml +# .idea/dynamic.xml + +## File-based project format +*.ipr +*.iws +*.iml + +## Additional for IntelliJ +out/ + +# generated by mpeltonen/sbt-idea plugin +.idea_modules/ + +# generated by JIRA plugin +atlassian-ide-plugin.xml + +# generated by Crashlytics plugin (for Android Studio and Intellij) +com_crashlytics_export_strings.xml From 3ddfa3bb9bfb4567c2ac2aee5f8b54cd9edbf251 Mon Sep 17 00:00:00 2001 From: Gerard Date: Sun, 11 May 2014 02:05:16 +0200 Subject: [PATCH 31/97] changed required idea version --- META-INF/plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index f154b84..6d33df2 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -23,7 +23,7 @@ The plugin will identify the currently used programming language through context
- + From 595cda4f9d30875e92d8ba41082c1146e483ef02 Mon Sep 17 00:00:00 2001 From: Bogdan Popescu Date: Sun, 11 May 2014 06:26:27 +0300 Subject: [PATCH 32/97] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f9e761..cd2a409 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ A simple plugin for the IntelliJ Platform (IntelliJ IDEA, RubyMine, WebStorm, Ph ## Installation To install the plugin in your IntelliJ IDE go to Preferences -> Plugins -> Browse repositories and search for "Dash". +**AppCode 1.x** users should manually install the plugin from: https://github.com/gdelmas/IntelliJDashPlugin/dsa/tag/2.2 + ## Kapeli Dash Dash is a Mac application for rapid search of developer documentation. It is free with nags to persuade you to pay and lose the nags. The free version is fully functional and super-useful. Get karma for buying and supporting the developer :) It can be downloaded here: [http://kapeli.com/dash](http://kapeli.com/dash) @@ -13,4 +15,4 @@ It either uses the current selection for the search, or the caret position. The ## Troubleshooting ######The installation from the repositories does not work -It looks like there is an IntelliJ/Java bug with OS X Mavericks which prevents to install plugins from the repositories. Please install the plugin manually from [here](https://github.com/gdelmas/IntelliJDashPlugin/releases). For additional information check [issue #13](https://github.com/gdelmas/IntelliJDashPlugin/issues/13). \ No newline at end of file +It looks like there is an IntelliJ/Java bug with OS X Mavericks which prevents to install plugins from the repositories. Please install the plugin manually from [here](https://github.com/gdelmas/IntelliJDashPlugin/releases). For additional information check [issue #13](https://github.com/gdelmas/IntelliJDashPlugin/issues/13). From a925e1042b46f22d93b709a9806186ae51c4126f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delm=C3=A0s?= Date: Sun, 11 May 2014 14:09:24 +0200 Subject: [PATCH 33/97] fixed AppCode 1.x url in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cd2a409..156f555 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ A simple plugin for the IntelliJ Platform (IntelliJ IDEA, RubyMine, WebStorm, Ph ## Installation To install the plugin in your IntelliJ IDE go to Preferences -> Plugins -> Browse repositories and search for "Dash". -**AppCode 1.x** users should manually install the plugin from: https://github.com/gdelmas/IntelliJDashPlugin/dsa/tag/2.2 +**AppCode 1.x** users have to manually install this version of the plugin: https://github.com/gdelmas/IntelliJDashPlugin/releases/tag/2.2 ## Kapeli Dash Dash is a Mac application for rapid search of developer documentation. It is free with nags to persuade you to pay and lose the nags. The free version is fully functional and super-useful. Get karma for buying and supporting the developer :) It can be downloaded here: From d6b8fb1cad510ab68ddc0b1e424cf5a3605cf934 Mon Sep 17 00:00:00 2001 From: Bogdan Popescu Date: Fri, 16 May 2014 04:43:49 +0300 Subject: [PATCH 34/97] Dash 2.1 keywords --- src/de/dreamlab/dash/KeywordLookup.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index b04053b..3c98fe4 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -33,26 +33,26 @@ public KeywordLookup() addLanguage("SCSS", "sass", "compass", "bourbon", "neat", "css"); addLanguage("Stylus", "stylus", "css"); // not PhpStorm addLanguage("HAML", "haml"); - addLanguage("CoffeeScript", "coffee", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "chai", "cordova", "phonegap"); - addLanguage("JavaScript", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "chai", "cordova", "phonegap"); + addLanguage("CoffeeScript", "coffee", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap"); + addLanguage("JavaScript", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap"); addLanguage("MySQL", "mysql"); // not WebStorm addLanguage("SQLite", "sqlite"); // not WebStorm // IntelliJ Community Edition 13.1 - addLanguage("JAVA", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing"); - addLanguage("JSP", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing"); // uncertain - addLanguage("JSPX", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing"); // uncertain + addLanguage("JAVA", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing", "javadoc"); + addLanguage("JSP", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing", "javadoc"); // uncertain + addLanguage("JSPX", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing", "javadoc"); // uncertain // Products listed for each entry - addLanguage("Dart", "dartlang"); // WebStorm (not yet supported by Dash) + addLanguage("Dart", "dartlang", "polymerdart", "angulardart"); // WebStorm (not yet supported by Dash) addLanguage("DjangoTemplate", "django"); // PyCharm addLanguage("Groovy", "groovy"); // IntelliJ addLanguage("Puppet", "puppet"); // RubyMine, PyCharm addLanguage("Jade", "jade"); // WebStorm addLanguage("JsInJade", "javascript", "jade"); // WebStorm addLanguage("Markdown", "markdown"); // PhpStorm - addLanguage("PHP", "php", "wordpress", "drupal", "zend", "laravel", "yii", "joomla", "ee", "codeigniter", "cakephp", "symfony", "typo3", "twig", "smarty"); // PhpStorm - addLanguage("Python", "python", "django", "twisted", "sphinx", "flask", "cvp"); // PyCharm + addLanguage("PHP", "php", "wordpress", "drupal", "zend", "laravel", "yii", "joomla", "ee", "codeigniter", "cakephp", "phpunit", "symfony", "typo3", "twig", "smarty", "phpp"); // PhpStorm + addLanguage("Python", "python", "django", "twisted", "sphinx", "flask", "tornado", "sqlalchemy", "numpy", "scipy", "salt", "cvp"); // PyCharm addLanguage("ruby", "ruby", "rubygems", "rails"); // RubyMine addLanguage("Smarty", "smarty"); // PhpStorm addLanguage("SmartyConfig", "smarty"); // PhpStorm From 637eaded18f667fc04dc8ae5241a50a83c3e78e1 Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 16 May 2014 21:48:14 +0200 Subject: [PATCH 35/97] updated project iml --- Dash.iml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dash.iml b/Dash.iml index d94fc7e..b2f3591 100644 --- a/Dash.iml +++ b/Dash.iml @@ -6,7 +6,7 @@ - + From 97d9de243fbdb9c1887809071b2f988c0af71885 Mon Sep 17 00:00:00 2001 From: Gerard Date: Sat, 17 May 2014 04:15:40 +0200 Subject: [PATCH 36/97] updated language list & added more languages context support - Bash - Go - Haskell - Lua - Markdown - Scala - TypoScript --- src/de/dreamlab/dash/KeywordLookup.java | 33 ++++++++++++++++--------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 3c98fe4..f4365b6 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -18,14 +18,14 @@ public KeywordLookup() { languageMap = new HashMap>(); - // IntelliJ Community Edition 13.1, WebStorm 8.0, PhpStorm 7.1, RubyMine 6.3, PyCharm 3.1 + // IntelliJ Ultimate Edition 13.1, WebStorm 8.0, PhpStorm 7.1, RubyMine 6.3, PyCharm 3.1 addLanguage("HTML", "html"); addLanguage("XHTML", "html"); addLanguage("XML", "xml"); addLanguage("XPath", "xml"); // not RubyMine, not PyCharm addLanguage("RegExp", "regex"); - // WebStorm 8.0, PhpStorm 7.1, RubyMine 6.3, PyCharm 3.1 + // IntelliJ Ultimate Edition 13.1, WebStorm 8.0, PhpStorm 7.1, RubyMine 6.3, PyCharm 3.1 addLanguage("CSS", "css"); addLanguage("JQuery-CSS", "css", "jquery", "jqueryui", "jquerym"); addLanguage("LESS", "less", "css"); @@ -33,31 +33,42 @@ public KeywordLookup() addLanguage("SCSS", "sass", "compass", "bourbon", "neat", "css"); addLanguage("Stylus", "stylus", "css"); // not PhpStorm addLanguage("HAML", "haml"); - addLanguage("CoffeeScript", "coffee", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap"); + addLanguage("CoffeeScript", "coffee", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap"); // not IntelliJ addLanguage("JavaScript", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap"); addLanguage("MySQL", "mysql"); // not WebStorm addLanguage("SQLite", "sqlite"); // not WebStorm - // IntelliJ Community Edition 13.1 - addLanguage("JAVA", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing", "javadoc"); - addLanguage("JSP", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing", "javadoc"); // uncertain - addLanguage("JSPX", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing", "javadoc"); // uncertain - // Products listed for each entry - addLanguage("Dart", "dartlang", "polymerdart", "angulardart"); // WebStorm (not yet supported by Dash) + addLanguage("Dart", "dartlang", "polymerdart", "angulardart"); // WebStorm addLanguage("DjangoTemplate", "django"); // PyCharm addLanguage("Groovy", "groovy"); // IntelliJ - addLanguage("Puppet", "puppet"); // RubyMine, PyCharm addLanguage("Jade", "jade"); // WebStorm + addLanguage("JAVA", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing", "javadoc"); // IntelliJ addLanguage("JsInJade", "javascript", "jade"); // WebStorm - addLanguage("Markdown", "markdown"); // PhpStorm + addLanguage("JSP", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "javadoc"); // IntelliJ, WebStorm, PhpStorm + addLanguage("JSPX", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "javadoc"); // IntelliJ, WebStorm, PhpStorm + addLanguage("Mxml", "actionscript"); // IntelliJ addLanguage("PHP", "php", "wordpress", "drupal", "zend", "laravel", "yii", "joomla", "ee", "codeigniter", "cakephp", "phpunit", "symfony", "typo3", "twig", "smarty", "phpp"); // PhpStorm + addLanguage("Play", "playjava"); // IntelliJ; uncertain + addLanguage("Puppet", "puppet"); // RubyMine, PyCharm addLanguage("Python", "python", "django", "twisted", "sphinx", "flask", "tornado", "sqlalchemy", "numpy", "scipy", "salt", "cvp"); // PyCharm addLanguage("ruby", "ruby", "rubygems", "rails"); // RubyMine addLanguage("Smarty", "smarty"); // PhpStorm addLanguage("SmartyConfig", "smarty"); // PhpStorm addLanguage("Twig", "twig"); // PhpStorm + // Jetbrains Plugins + addLanguage("Haskell", "haskell"); + addLanguage("Scala", "scala", "akka", "playscala"); + addLanguage("SSP", "scala", "akka", "playscala"); + addLanguage("TypoScript", "typo3"); + + // Third-party Plugins + addLanguage("Bash", "bash", "manpages"); + addLanguage("Google Go", "go" ,"godoc"); + addLanguage("Lua", "lua", "corona"); + addLanguage("Markdown", "markdown"); + /* use the following command to display all available languages in the event log. intended for development purposes. From db66a085f0b109b75fae83f07b4145cdaaf44d9e Mon Sep 17 00:00:00 2001 From: Gerard Date: Sat, 17 May 2014 21:49:12 +0200 Subject: [PATCH 37/97] added angularjs to keywords fixes #22 --- src/de/dreamlab/dash/KeywordLookup.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index f4365b6..2f780ea 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -19,7 +19,7 @@ public KeywordLookup() languageMap = new HashMap>(); // IntelliJ Ultimate Edition 13.1, WebStorm 8.0, PhpStorm 7.1, RubyMine 6.3, PyCharm 3.1 - addLanguage("HTML", "html"); + addLanguage("HTML", "html", "angularjs"); addLanguage("XHTML", "html"); addLanguage("XML", "xml"); addLanguage("XPath", "xml"); // not RubyMine, not PyCharm @@ -34,7 +34,7 @@ public KeywordLookup() addLanguage("Stylus", "stylus", "css"); // not PhpStorm addLanguage("HAML", "haml"); addLanguage("CoffeeScript", "coffee", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap"); // not IntelliJ - addLanguage("JavaScript", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap"); + addLanguage("JavaScript", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap", "angularjs"); addLanguage("MySQL", "mysql"); // not WebStorm addLanguage("SQLite", "sqlite"); // not WebStorm From 0f80be644ba8919b514b6b30fcb0a9f55b4e94a5 Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Thu, 1 May 2014 18:33:21 +0800 Subject: [PATCH 38/97] Better integration for Android projects. Instead of just relying on the IDE product code, this checks the project's assigned SDK and picks an Android-oriented keyword lookup object instance. This is needed since recent IntelliJ versions allow creating Android projects as well as normal Java ones. As a bonus, the default keyword lookup dataset now contains more appropriate keywords for JSP/JSPX pages. --- .../dreamlab/dash/AndroidKeywordLookup.java | 16 +++++++ src/de/dreamlab/dash/DashLauncherAction.java | 45 +++++++++++++++---- src/de/dreamlab/dash/KeywordLookup.java | 37 +++++++-------- 3 files changed, 69 insertions(+), 29 deletions(-) create mode 100644 src/de/dreamlab/dash/AndroidKeywordLookup.java diff --git a/src/de/dreamlab/dash/AndroidKeywordLookup.java b/src/de/dreamlab/dash/AndroidKeywordLookup.java new file mode 100644 index 0000000..11fd5a7 --- /dev/null +++ b/src/de/dreamlab/dash/AndroidKeywordLookup.java @@ -0,0 +1,16 @@ +package de.dreamlab.dash; + +public class AndroidKeywordLookup extends KeywordLookup { + + public AndroidKeywordLookup(final DashLauncher dashLauncher) { + super(dashLauncher); + } + + @Override + protected void setUpLanguages() { + super.setUpLanguages(); + + // Android Studio 0.5.7 + addLanguage("JAVA", "android", "javadoc", "cvj", "processing"); + } +} diff --git a/src/de/dreamlab/dash/DashLauncherAction.java b/src/de/dreamlab/dash/DashLauncherAction.java index fa00351..6dd3c0b 100644 --- a/src/de/dreamlab/dash/DashLauncherAction.java +++ b/src/de/dreamlab/dash/DashLauncherAction.java @@ -8,21 +8,28 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.SelectionModel; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.projectRoots.SdkTypeId; +import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.wm.impl.status.StatusBarUtil; import com.intellij.psi.PsiComment; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; public class DashLauncherAction extends AnAction { + private final KeywordLookup androidKeywordLookup; + private final KeywordLookup defaultKeywordLookup; + private static final String XML_LANGUAGE_ID = "XML"; - private KeywordLookup keywordLookup; - private DashLauncher dashLauncher; + private static final String ANDROID_SDK_ID = "Android SDK"; public DashLauncherAction() { - keywordLookup = new KeywordLookup(); - dashLauncher = new DashLauncher(); + final DashLauncher launcher = new DashLauncher(); + androidKeywordLookup = new AndroidKeywordLookup(launcher); + defaultKeywordLookup = new KeywordLookup(launcher); } @Override @@ -37,13 +44,13 @@ public void actionPerformed(AnActionEvent e) { PsiElement psiElement = null; Language language = null; + String query; + if ( psiFile != null ) { psiElement = psiFile.findElementAt(editor.getCaretModel().getOffset()); language = elementLanguage(psiElement); } - String query = null; - SelectionModel selectionModel = editor.getSelectionModel(); if ( selectionModel.hasSelection() ) { query = selectionModel.getSelectedText(); @@ -58,6 +65,24 @@ public void actionPerformed(AnActionEvent e) { } if ( query != null ) { + final Project project = e.getProject(); + if (project == null) { + return; + } + + KeywordLookup keywordLookup = defaultKeywordLookup; + + // Check if the current project is Java + Android, or otherwise. + + final ProjectRootManager projectRootManager = ProjectRootManager.getInstance(project); + final Sdk sdk = projectRootManager.getProjectSdk(); + if (sdk != null) { + final SdkTypeId sdkTypeId = sdk.getSdkType(); + if (ANDROID_SDK_ID.equals(sdkTypeId.getName())) { + keywordLookup = androidKeywordLookup; + } + } + // show status message for potential troubleshooting String resolvedLanguage = keywordLookup.findLanguageName(language); @@ -73,10 +98,10 @@ public void actionPerformed(AnActionEvent e) { message += ". Based on \"" + language.getID() + "\" context"; } - StatusBarUtil.setStatusBarInfo(e.getProject(), message); + StatusBarUtil.setStatusBarInfo(project, message); // open dash - dashLauncher.search(keywordLookup.findKeywords(language), query); + keywordLookup.searchOnDash(language, query); } } @@ -89,7 +114,9 @@ private Language elementLanguage(PsiElement element) if ( XML_LANGUAGE_ID.equals(element.getLanguage().getID()) ) { PsiElement parent = element.getParent(); - if ( !XML_LANGUAGE_ID.equals(parent.getLanguage().getID()) && XML_LANGUAGE_ID.equals(parent.getLanguage().getBaseLanguage().getID()) ) { + final Language parentLanguage = parent.getLanguage(); + final Language baseLanguage = parentLanguage.getBaseLanguage(); + if ( baseLanguage == null || (!XML_LANGUAGE_ID.equals(parentLanguage.getID()) && XML_LANGUAGE_ID.equals(baseLanguage.getID())) ) { return parent.getLanguage(); } } diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 2f780ea..75cc856 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -4,20 +4,20 @@ import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; import com.intellij.notification.Notifications; -import com.intellij.openapi.application.ApplicationInfo; -import com.intellij.openapi.ui.Messages; import java.util.*; public class KeywordLookup { - private static final String ANDROID_STUDIO_PRODUCT_CODE = "AI"; + protected final Map> languageMap = new HashMap>(); + protected final DashLauncher launcher; - private HashMap> languageMap; - - public KeywordLookup() + public KeywordLookup(final DashLauncher dashLauncher) { - languageMap = new HashMap>(); + launcher = dashLauncher; + setUpLanguages(); + } + protected void setUpLanguages() { // IntelliJ Ultimate Edition 13.1, WebStorm 8.0, PhpStorm 7.1, RubyMine 6.3, PyCharm 3.1 addLanguage("HTML", "html", "angularjs"); addLanguage("XHTML", "html"); @@ -38,6 +38,11 @@ public KeywordLookup() addLanguage("MySQL", "mysql"); // not WebStorm addLanguage("SQLite", "sqlite"); // not WebStorm + // IntelliJ Community Edition 13.1 + addLanguage("JAVA", "java6", "java7", "java8", "jee6", "jee7", "javadoc", "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing"); + addLanguage("JSP", "java6", "java7", "java8", "jee6", "jee7", "javadoc", "grails", "groovy", "playjava", "spring", "html", "xml", "css"); + addLanguage("JSPX", "java6", "java7", "java8", "jee6", "jee7", "javadoc", "grails", "groovy", "playjava", "spring", "html", "xml", "css"); + // Products listed for each entry addLanguage("Dart", "dartlang", "polymerdart", "angulardart"); // WebStorm addLanguage("DjangoTemplate", "django"); // PyCharm @@ -69,14 +74,12 @@ public KeywordLookup() addLanguage("Lua", "lua", "corona"); addLanguage("Markdown", "markdown"); - /* use the following command to display all available languages in the event log. intended for development purposes. listRegisteredLanguages(); */ } - private void listRegisteredLanguages() { Collection languages = Language.getRegisteredLanguages(); @@ -104,12 +107,12 @@ private void listRegisteredLanguages() { Notifications.Bus.notify(new Notification("Dash", "Dash: Registered Languages ", message, NotificationType.INFORMATION)); } - private void addLanguage(String language, String... keywords) + protected void addLanguage(String language, String... keywords) { languageMap.put(language, Arrays.asList(keywords)); } - public String findLanguageName(Language language) + protected String findLanguageName(Language language) { while ( language != null ) { if ( languageMap.containsKey(language.getID()) ) { @@ -122,7 +125,7 @@ public String findLanguageName(Language language) return null; } - public List findKeywords(Language language) + protected List findKeywords(Language language) { String languageName = findLanguageName(language); @@ -134,13 +137,7 @@ public List findKeywords(Language language) } } - private String javaKeyword() - { - if ( ANDROID_STUDIO_PRODUCT_CODE.equals(ApplicationInfo.getInstance().getBuild().getProductCode()) ) { - return "android"; - } - else { - return "java"; - } + public void searchOnDash(final Language language, final String query) { + launcher.search(findKeywords(language), query); } } From 8ff1dd9fcbb1ccbbd190710f5f766f336c07e1d1 Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Fri, 2 May 2014 00:33:50 +0800 Subject: [PATCH 39/97] New SDK detection logic in place. --- src/de/dreamlab/dash/DashLauncherAction.java | 69 ++++++++++++++++---- 1 file changed, 55 insertions(+), 14 deletions(-) diff --git a/src/de/dreamlab/dash/DashLauncherAction.java b/src/de/dreamlab/dash/DashLauncherAction.java index 6dd3c0b..6074751 100644 --- a/src/de/dreamlab/dash/DashLauncherAction.java +++ b/src/de/dreamlab/dash/DashLauncherAction.java @@ -8,10 +8,14 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.SelectionModel; +import com.intellij.openapi.module.Module; +import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.projectRoots.SdkTypeId; +import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.roots.ProjectRootManager; +import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.impl.status.StatusBarUtil; import com.intellij.psi.PsiComment; import com.intellij.psi.PsiElement; @@ -39,16 +43,44 @@ public void update(AnActionEvent e) { public void actionPerformed(AnActionEvent e) { Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext()); + if (editor == null) { + return; + } + + final Project project = e.getProject(); + if (project == null) { + return; + } - PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE); + // Get the module associated with the PSI_FILE item, if one is present. + + Module module = null; + final PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE); PsiElement psiElement = null; Language language = null; String query; if ( psiFile != null ) { + module = ModuleUtil.findModuleForPsiElement(psiFile); + psiElement = psiFile.findElementAt(editor.getCaretModel().getOffset()); language = elementLanguage(psiElement); + + // Get the module associated with the PsiElement, if one is present. + + if (module == null && psiElement != null) { + module = ModuleUtil.findModuleForPsiElement(psiElement); + } + } + + // Get the module associated with the VIRTUAL_FILE, if one is present. + + if (module == null) { + final VirtualFile virtualFile = e.getData(LangDataKeys.VIRTUAL_FILE); + if (virtualFile != null) { + module = ModuleUtil.findModuleForFile(virtualFile, project); + } } SelectionModel selectionModel = editor.getSelectionModel(); @@ -65,17 +97,25 @@ public void actionPerformed(AnActionEvent e) { } if ( query != null ) { - final Project project = e.getProject(); - if (project == null) { - return; - } KeywordLookup keywordLookup = defaultKeywordLookup; + /* + + Get the SDK associated with the previously found module, or use the project-wide SDK if + no module has been found. + + */ + + final Sdk sdk; + if (module != null) { + sdk = ModuleRootManager.getInstance(module).getSdk(); + } else { + sdk = ProjectRootManager.getInstance(project).getProjectSdk(); + } + // Check if the current project is Java + Android, or otherwise. - final ProjectRootManager projectRootManager = ProjectRootManager.getInstance(project); - final Sdk sdk = projectRootManager.getProjectSdk(); if (sdk != null) { final SdkTypeId sdkTypeId = sdk.getSdkType(); if (ANDROID_SDK_ID.equals(sdkTypeId.getName())) { @@ -84,21 +124,22 @@ public void actionPerformed(AnActionEvent e) { } // show status message for potential troubleshooting - String resolvedLanguage = keywordLookup.findLanguageName(language); + final String resolvedLanguage = keywordLookup.findLanguageName(language); + + final StringBuilder stringBuilder = new StringBuilder(); - String message; if ( resolvedLanguage == null ) { - message = "Searching all docsets in Dash"; + stringBuilder.append("Searching all docsets in Dash"); } else { - message = "Searching \"" + resolvedLanguage + "\" docsets in Dash"; + stringBuilder.append(String.format("Searching \"%s\" docsets in Dash.", resolvedLanguage)); } - if ( !language.getID().equals(resolvedLanguage) ) { - message += ". Based on \"" + language.getID() + "\" context"; + if (language != null && resolvedLanguage != null && !resolvedLanguage.equals(language.getID())) { + stringBuilder.append(String.format(" Based on \"%s\" context.", language.getID())); } - StatusBarUtil.setStatusBarInfo(project, message); + StatusBarUtil.setStatusBarInfo(project, stringBuilder.toString()); // open dash keywordLookup.searchOnDash(language, query); From 0c203fcdfb3c64b99033d654f4155ba9ad3820ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Mon, 2 Jun 2014 17:45:20 +0200 Subject: [PATCH 40/97] sdk context detection --- .../dreamlab/dash/AndroidKeywordLookup.java | 16 -- src/de/dreamlab/dash/DashLauncherAction.java | 161 ++++++++++-------- src/de/dreamlab/dash/KeywordLookup.java | 152 ++++++++++------- .../dash/keywords/ExcludeSdkTypeKeyword.java | 22 +++ src/de/dreamlab/dash/keywords/IKeyword.java | 9 + src/de/dreamlab/dash/keywords/Keyword.java | 15 ++ .../dash/keywords/SdkTypeSpecificKeyword.java | 39 +++++ 7 files changed, 259 insertions(+), 155 deletions(-) delete mode 100644 src/de/dreamlab/dash/AndroidKeywordLookup.java create mode 100644 src/de/dreamlab/dash/keywords/ExcludeSdkTypeKeyword.java create mode 100644 src/de/dreamlab/dash/keywords/IKeyword.java create mode 100644 src/de/dreamlab/dash/keywords/Keyword.java create mode 100644 src/de/dreamlab/dash/keywords/SdkTypeSpecificKeyword.java diff --git a/src/de/dreamlab/dash/AndroidKeywordLookup.java b/src/de/dreamlab/dash/AndroidKeywordLookup.java deleted file mode 100644 index 11fd5a7..0000000 --- a/src/de/dreamlab/dash/AndroidKeywordLookup.java +++ /dev/null @@ -1,16 +0,0 @@ -package de.dreamlab.dash; - -public class AndroidKeywordLookup extends KeywordLookup { - - public AndroidKeywordLookup(final DashLauncher dashLauncher) { - super(dashLauncher); - } - - @Override - protected void setUpLanguages() { - super.setUpLanguages(); - - // Android Studio 0.5.7 - addLanguage("JAVA", "android", "javadoc", "cvj", "processing"); - } -} diff --git a/src/de/dreamlab/dash/DashLauncherAction.java b/src/de/dreamlab/dash/DashLauncherAction.java index 6074751..0b997f5 100644 --- a/src/de/dreamlab/dash/DashLauncherAction.java +++ b/src/de/dreamlab/dash/DashLauncherAction.java @@ -2,6 +2,9 @@ import com.intellij.lang.Language; +import com.intellij.notification.Notification; +import com.intellij.notification.NotificationType; +import com.intellij.notification.Notifications; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.LangDataKeys; @@ -12,7 +15,6 @@ import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.projectRoots.SdkTypeId; import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.vfs.VirtualFile; @@ -22,18 +24,15 @@ import com.intellij.psi.PsiFile; public class DashLauncherAction extends AnAction { - private final KeywordLookup androidKeywordLookup; - private final KeywordLookup defaultKeywordLookup; - private static final String XML_LANGUAGE_ID = "XML"; - private static final String ANDROID_SDK_ID = "Android SDK"; + private KeywordLookup keywordLookup; + private DashLauncher dashLauncher; public DashLauncherAction() { - final DashLauncher launcher = new DashLauncher(); - androidKeywordLookup = new AndroidKeywordLookup(launcher); - defaultKeywordLookup = new KeywordLookup(launcher); + keywordLookup = new KeywordLookup(); + dashLauncher = new DashLauncher(); } @Override @@ -42,46 +41,21 @@ public void update(AnActionEvent e) { } public void actionPerformed(AnActionEvent e) { - Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext()); - if (editor == null) { + final Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext()); + if ( editor == null ) { return; } - final Project project = e.getProject(); - if (project == null) { - return; - } - - // Get the module associated with the PSI_FILE item, if one is present. - - Module module = null; final PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE); PsiElement psiElement = null; Language language = null; - String query; - if ( psiFile != null ) { - module = ModuleUtil.findModuleForPsiElement(psiFile); - psiElement = psiFile.findElementAt(editor.getCaretModel().getOffset()); language = elementLanguage(psiElement); - - // Get the module associated with the PsiElement, if one is present. - - if (module == null && psiElement != null) { - module = ModuleUtil.findModuleForPsiElement(psiElement); - } } - // Get the module associated with the VIRTUAL_FILE, if one is present. - - if (module == null) { - final VirtualFile virtualFile = e.getData(LangDataKeys.VIRTUAL_FILE); - if (virtualFile != null) { - module = ModuleUtil.findModuleForFile(virtualFile, project); - } - } + String query; SelectionModel selectionModel = editor.getSelectionModel(); if ( selectionModel.hasSelection() ) { @@ -97,53 +71,89 @@ public void actionPerformed(AnActionEvent e) { } if ( query != null ) { + // show status message for potential troubleshooting + String resolvedLanguage = keywordLookup.findLanguageName(language); - KeywordLookup keywordLookup = defaultKeywordLookup; + final StringBuilder messageBuilder = new StringBuilder(); - /* + if ( resolvedLanguage == null ) { + messageBuilder.append("Searching all docsets in Dash"); + } + else { + messageBuilder.append(String.format("Searching \"%s\" docsets in Dash", resolvedLanguage)); + } - Get the SDK associated with the previously found module, or use the project-wide SDK if - no module has been found. + if ( language != null && !language.getID().equals(resolvedLanguage) ) { + messageBuilder.append(String.format(" Based on \"%s\" context.", language.getID())); + } - */ + Project project = e.getProject(); - final Sdk sdk; - if (module != null) { - sdk = ModuleRootManager.getInstance(module).getSdk(); - } else { - sdk = ProjectRootManager.getInstance(project).getProjectSdk(); + if ( project != null ) { + StatusBarUtil.setStatusBarInfo(project, messageBuilder.toString()); } - // Check if the current project is Java + Android, or otherwise. + // open dash + dashLauncher.search(keywordLookup.findKeywords(language, getSdk(e, psiElement)), query); - if (sdk != null) { - final SdkTypeId sdkTypeId = sdk.getSdkType(); - if (ANDROID_SDK_ID.equals(sdkTypeId.getName())) { - keywordLookup = androidKeywordLookup; - } - } + /* + use the following command to display information about the sdk in use in the event log. intended for development purposes. + showSdkDebug(getSdk(e, psiElement)); + */ + } + } - // show status message for potential troubleshooting - final String resolvedLanguage = keywordLookup.findLanguageName(language); + private Sdk getSdk(AnActionEvent actionEvent, PsiElement psiElement) + { + final PsiFile psiFile = actionEvent.getData(LangDataKeys.PSI_FILE); + final Project project = actionEvent.getProject(); + Module module = null; - final StringBuilder stringBuilder = new StringBuilder(); + if ( psiFile != null ) { + module = ModuleUtil.findModuleForPsiElement(psiFile); - if ( resolvedLanguage == null ) { - stringBuilder.append("Searching all docsets in Dash"); - } - else { - stringBuilder.append(String.format("Searching \"%s\" docsets in Dash.", resolvedLanguage)); + // Get the module associated with the PsiElement, if one is present. + if (module == null && psiElement != null) { + module = ModuleUtil.findModuleForPsiElement(psiElement); } + } + + // Get the module associated with the VIRTUAL_FILE, if one is present. + if ( module == null ) { + final VirtualFile virtualFile = actionEvent.getData(LangDataKeys.VIRTUAL_FILE); - if (language != null && resolvedLanguage != null && !resolvedLanguage.equals(language.getID())) { - stringBuilder.append(String.format(" Based on \"%s\" context.", language.getID())); + if ( virtualFile != null && project != null ) { + module = ModuleUtil.findModuleForFile(virtualFile, project); } + } + + // Get the SDK associated with the previously found module, or use the project-wide SDK if no module has been found. + if ( module != null ) { + return ModuleRootManager.getInstance(module).getSdk(); + } + else if ( project != null) { + return ProjectRootManager.getInstance(project).getProjectSdk(); + } + else { + return null; + } + } + + private void showSdkDebug(Sdk sdk) + { + StringBuilder sdkMessage = new StringBuilder(); - StatusBarUtil.setStatusBarInfo(project, stringBuilder.toString()); + if ( sdk != null ) { + sdkMessage.append(String.format("Name: %s\n", sdk.getName())); + sdkMessage.append(String.format("SdkType: %s\n", sdk.getSdkType().getName())); + sdkMessage.append(String.format("VersionString: %s\n", sdk.getVersionString())); - // open dash - keywordLookup.searchOnDash(language, query); } + else { + sdkMessage.append("not available"); + } + + Notifications.Bus.notify(new Notification("Dash", "Dash SDK: ", sdkMessage.toString(), NotificationType.INFORMATION)); } private Language elementLanguage(PsiElement element) @@ -152,17 +162,20 @@ private Language elementLanguage(PsiElement element) return null; } - if ( XML_LANGUAGE_ID.equals(element.getLanguage().getID()) ) { - PsiElement parent = element.getParent(); + try { + if ( XML_LANGUAGE_ID.equals(element.getLanguage().getID()) ) { + PsiElement parent = element.getParent(); - final Language parentLanguage = parent.getLanguage(); - final Language baseLanguage = parentLanguage.getBaseLanguage(); - if ( baseLanguage == null || (!XML_LANGUAGE_ID.equals(parentLanguage.getID()) && XML_LANGUAGE_ID.equals(baseLanguage.getID())) ) { - return parent.getLanguage(); + if ( !XML_LANGUAGE_ID.equals(parent.getLanguage().getID()) && XML_LANGUAGE_ID.equals(parent.getLanguage().getBaseLanguage().getID()) ) { + return parent.getLanguage(); + } } - } - return element.getLanguage(); + return element.getLanguage(); + } + catch ( NullPointerException e ) { + return null; + } } private String getWordAtCursor(Editor editor) { diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 75cc856..da2eded 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -4,75 +4,79 @@ import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; import com.intellij.notification.Notifications; +import com.intellij.openapi.projectRoots.Sdk; +import de.dreamlab.dash.keywords.ExcludeSdkTypeKeyword; +import de.dreamlab.dash.keywords.IKeyword; +import de.dreamlab.dash.keywords.Keyword; +import de.dreamlab.dash.keywords.SdkTypeSpecificKeyword; import java.util.*; public class KeywordLookup { - protected final Map> languageMap = new HashMap>(); - protected final DashLauncher launcher; + private HashMap> languageMap; - public KeywordLookup(final DashLauncher dashLauncher) + public KeywordLookup() { - launcher = dashLauncher; - setUpLanguages(); - } + languageMap = new HashMap>(); - protected void setUpLanguages() { // IntelliJ Ultimate Edition 13.1, WebStorm 8.0, PhpStorm 7.1, RubyMine 6.3, PyCharm 3.1 - addLanguage("HTML", "html", "angularjs"); - addLanguage("XHTML", "html"); - addLanguage("XML", "xml"); - addLanguage("XPath", "xml"); // not RubyMine, not PyCharm - addLanguage("RegExp", "regex"); + setLanguage("HTML", "html", "angularjs"); + setLanguage("XHTML", "html"); + setLanguage("XML", "xml"); + setLanguage("XPath", "xml"); // not RubyMine, not PyCharm + setLanguage("RegExp", "regex"); // IntelliJ Ultimate Edition 13.1, WebStorm 8.0, PhpStorm 7.1, RubyMine 6.3, PyCharm 3.1 - addLanguage("CSS", "css"); - addLanguage("JQuery-CSS", "css", "jquery", "jqueryui", "jquerym"); - addLanguage("LESS", "less", "css"); - addLanguage("SASS", "sass", "compass", "bourbon", "neat", "css"); - addLanguage("SCSS", "sass", "compass", "bourbon", "neat", "css"); - addLanguage("Stylus", "stylus", "css"); // not PhpStorm - addLanguage("HAML", "haml"); - addLanguage("CoffeeScript", "coffee", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap"); // not IntelliJ - addLanguage("JavaScript", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap", "angularjs"); - addLanguage("MySQL", "mysql"); // not WebStorm - addLanguage("SQLite", "sqlite"); // not WebStorm - - // IntelliJ Community Edition 13.1 - addLanguage("JAVA", "java6", "java7", "java8", "jee6", "jee7", "javadoc", "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing"); - addLanguage("JSP", "java6", "java7", "java8", "jee6", "jee7", "javadoc", "grails", "groovy", "playjava", "spring", "html", "xml", "css"); - addLanguage("JSPX", "java6", "java7", "java8", "jee6", "jee7", "javadoc", "grails", "groovy", "playjava", "spring", "html", "xml", "css"); + setLanguage("CSS", "css"); + setLanguage("JQuery-CSS", "css", "jquery", "jqueryui", "jquerym"); + setLanguage("LESS", "less", "css"); + setLanguage("SASS", "sass", "compass", "bourbon", "neat", "css"); + setLanguage("SCSS", "sass", "compass", "bourbon", "neat", "css"); + setLanguage("Stylus", "stylus", "css"); // not PhpStorm + setLanguage("HAML", "haml"); + setLanguage("CoffeeScript", "coffee", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap"); // not IntelliJ + setLanguage("JavaScript", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap", "angularjs"); + setLanguage("MySQL", "mysql"); // not WebStorm + setLanguage("SQLite", "sqlite"); // not WebStorm // Products listed for each entry - addLanguage("Dart", "dartlang", "polymerdart", "angulardart"); // WebStorm - addLanguage("DjangoTemplate", "django"); // PyCharm - addLanguage("Groovy", "groovy"); // IntelliJ - addLanguage("Jade", "jade"); // WebStorm - addLanguage("JAVA", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing", "javadoc"); // IntelliJ - addLanguage("JsInJade", "javascript", "jade"); // WebStorm - addLanguage("JSP", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "javadoc"); // IntelliJ, WebStorm, PhpStorm - addLanguage("JSPX", javaKeyword(), "javafx", "grails", "groovy", "playjava", "spring", "cvj", "javadoc"); // IntelliJ, WebStorm, PhpStorm - addLanguage("Mxml", "actionscript"); // IntelliJ - addLanguage("PHP", "php", "wordpress", "drupal", "zend", "laravel", "yii", "joomla", "ee", "codeigniter", "cakephp", "phpunit", "symfony", "typo3", "twig", "smarty", "phpp"); // PhpStorm - addLanguage("Play", "playjava"); // IntelliJ; uncertain - addLanguage("Puppet", "puppet"); // RubyMine, PyCharm - addLanguage("Python", "python", "django", "twisted", "sphinx", "flask", "tornado", "sqlalchemy", "numpy", "scipy", "salt", "cvp"); // PyCharm - addLanguage("ruby", "ruby", "rubygems", "rails"); // RubyMine - addLanguage("Smarty", "smarty"); // PhpStorm - addLanguage("SmartyConfig", "smarty"); // PhpStorm - addLanguage("Twig", "twig"); // PhpStorm + final IKeyword javaKeyword = new SdkTypeSpecificKeyword("java", "Android SDK", "android"); + final IKeyword javaFxKeyword = new ExcludeSdkTypeKeyword("javafx", "Android SDK"); + final IKeyword grailsKeyword = new ExcludeSdkTypeKeyword("grails", "Android SDK"); + final IKeyword groovyKeyword = new ExcludeSdkTypeKeyword("groovy", "Android SDK"); + final IKeyword playjavaKeyword = new ExcludeSdkTypeKeyword("playjava", "Android SDK"); + final IKeyword springKeyword = new ExcludeSdkTypeKeyword("spring", "Android SDK"); + + setLanguage("Dart", "dartlang", "polymerdart", "angulardart"); // WebStorm + setLanguage("DjangoTemplate", "django"); // PyCharm + setLanguage("Groovy", "groovy"); // IntelliJ + setLanguage("Jade", "jade"); // WebStorm + setLanguage("JAVA", javaKeyword, javaFxKeyword, grailsKeyword, groovyKeyword, playjavaKeyword, springKeyword, "cvj", "processing", "javadoc"); // IntelliJ + setLanguage("JsInJade", "javascript", "jade"); // WebStorm + setLanguage("JSP", javaKeyword, javaFxKeyword, grailsKeyword, groovyKeyword, playjavaKeyword, springKeyword, "cvj", "javadoc"); // IntelliJ, WebStorm, PhpStorm + setLanguage("JSPX", javaKeyword, javaFxKeyword, grailsKeyword, groovyKeyword, playjavaKeyword, springKeyword, "cvj", "javadoc"); // IntelliJ, WebStorm, PhpStorm + setLanguage("Mxml", "actionscript"); // IntelliJ + setLanguage("PHP", "php", "wordpress", "drupal", "zend", "laravel", "yii", "joomla", "ee", "codeigniter", "cakephp", "phpunit", "symfony", "typo3", "twig", "smarty", "phpp"); // PhpStorm + setLanguage("Play", "playjava"); // IntelliJ; uncertain + setLanguage("Puppet", "puppet"); // RubyMine, PyCharm + setLanguage("Python", "python", "django", "twisted", "sphinx", "flask", "tornado", "sqlalchemy", "numpy", "scipy", "salt", "cvp"); // PyCharm + setLanguage("ruby", "ruby", "rubygems", "rails"); // RubyMine + setLanguage("Smarty", "smarty"); // PhpStorm + setLanguage("SmartyConfig", "smarty"); // PhpStorm + setLanguage("Twig", "twig"); // PhpStorm // Jetbrains Plugins - addLanguage("Haskell", "haskell"); - addLanguage("Scala", "scala", "akka", "playscala"); - addLanguage("SSP", "scala", "akka", "playscala"); - addLanguage("TypoScript", "typo3"); + setLanguage("Haskell", "haskell"); + setLanguage("Scala", "scala", "akka", "playscala"); + setLanguage("SSP", "scala", "akka", "playscala"); + setLanguage("TypoScript", "typo3"); // Third-party Plugins - addLanguage("Bash", "bash", "manpages"); - addLanguage("Google Go", "go" ,"godoc"); - addLanguage("Lua", "lua", "corona"); - addLanguage("Markdown", "markdown"); + setLanguage("Bash", "bash", "manpages"); + setLanguage("Google Go", "go", "godoc"); + setLanguage("Lua", "lua", "corona"); + setLanguage("Markdown", "markdown"); + /* use the following command to display all available languages in the event log. intended for development purposes. @@ -80,6 +84,7 @@ protected void setUpLanguages() { */ } + private void listRegisteredLanguages() { Collection languages = Language.getRegisteredLanguages(); @@ -107,12 +112,27 @@ private void listRegisteredLanguages() { Notifications.Bus.notify(new Notification("Dash", "Dash: Registered Languages ", message, NotificationType.INFORMATION)); } - protected void addLanguage(String language, String... keywords) + private void setLanguage(String language, Object... keywords) { - languageMap.put(language, Arrays.asList(keywords)); + ArrayList keywordList = new ArrayList(); + + for (Object keyword : keywords) { + if ( keyword instanceof String ) { + keywordList.add(new Keyword((String) keyword)); + } + else if ( keyword instanceof IKeyword ) { + keywordList.add((IKeyword) keyword); + } + else { + throw new Error("Invalid keyword"); + } + + } + + languageMap.put(language, keywordList); } - protected String findLanguageName(Language language) + public String findLanguageName(Language language) { while ( language != null ) { if ( languageMap.containsKey(language.getID()) ) { @@ -125,19 +145,21 @@ protected String findLanguageName(Language language) return null; } - protected List findKeywords(Language language) + public List findKeywords(Language language, Sdk sdk) { - String languageName = findLanguageName(language); + ArrayList result = new ArrayList(); + String languageName = findLanguageName(language); if ( languageName != null ) { - return languageMap.get(languageName); - } - else { - return new ArrayList(); + for ( IKeyword keyword : languageMap.get(languageName) ) { + String name = keyword.getName(sdk); + + if ( name != null ) { + result.add(name); + } + } } - } - public void searchOnDash(final Language language, final String query) { - launcher.search(findKeywords(language), query); + return result; } } diff --git a/src/de/dreamlab/dash/keywords/ExcludeSdkTypeKeyword.java b/src/de/dreamlab/dash/keywords/ExcludeSdkTypeKeyword.java new file mode 100644 index 0000000..8af9ab1 --- /dev/null +++ b/src/de/dreamlab/dash/keywords/ExcludeSdkTypeKeyword.java @@ -0,0 +1,22 @@ +package de.dreamlab.dash.keywords; + +import com.intellij.openapi.projectRoots.Sdk; + +public class ExcludeSdkTypeKeyword implements IKeyword { + private String keyword; + private String sdkType; + + public ExcludeSdkTypeKeyword(String keyword, String sdkType) { + this.keyword = keyword; + this.sdkType = sdkType; + } + + public String getName(Sdk sdk) { + if ( sdkType != null && !sdkType.equals(sdk.getSdkType().getName()) ) { + return keyword; + } + else { + return null; + } + } +} diff --git a/src/de/dreamlab/dash/keywords/IKeyword.java b/src/de/dreamlab/dash/keywords/IKeyword.java new file mode 100644 index 0000000..100b0cb --- /dev/null +++ b/src/de/dreamlab/dash/keywords/IKeyword.java @@ -0,0 +1,9 @@ +package de.dreamlab.dash.keywords; + +import com.intellij.openapi.projectRoots.Sdk; +import com.sun.istack.internal.Nullable; + +public interface IKeyword { + @Nullable + public String getName(Sdk sdk); +} diff --git a/src/de/dreamlab/dash/keywords/Keyword.java b/src/de/dreamlab/dash/keywords/Keyword.java new file mode 100644 index 0000000..8cbf8bd --- /dev/null +++ b/src/de/dreamlab/dash/keywords/Keyword.java @@ -0,0 +1,15 @@ +package de.dreamlab.dash.keywords; + +import com.intellij.openapi.projectRoots.Sdk; + +public class Keyword implements IKeyword { + private String keyword; + + public Keyword(String keyword) { + this.keyword = keyword; + } + + public String getName(Sdk sdk) { + return keyword; + } +} diff --git a/src/de/dreamlab/dash/keywords/SdkTypeSpecificKeyword.java b/src/de/dreamlab/dash/keywords/SdkTypeSpecificKeyword.java new file mode 100644 index 0000000..1fa67a3 --- /dev/null +++ b/src/de/dreamlab/dash/keywords/SdkTypeSpecificKeyword.java @@ -0,0 +1,39 @@ +package de.dreamlab.dash.keywords; + +import com.intellij.openapi.projectRoots.Sdk; + +import java.util.HashMap; + + +public class SdkTypeSpecificKeyword implements IKeyword { + private String defaultKeyword = null; + private HashMap sdkTypes; + + public SdkTypeSpecificKeyword(String defaultKeyword, String... sdkTypesAndKeywords) { + if ( (sdkTypesAndKeywords.length % 2) != 0 ) { + throw new Error("Missing keyword for sdk: " + sdkTypesAndKeywords[sdkTypesAndKeywords.length - 1]); + } + + this.defaultKeyword = defaultKeyword; + + sdkTypes = new HashMap(); + + for ( int i = 0; i < sdkTypesAndKeywords.length; i += 2 ) { + sdkTypes.put(sdkTypesAndKeywords[0], sdkTypesAndKeywords[1]); + } + } + + public SdkTypeSpecificKeyword(String keyword, String sdkType) { + sdkTypes = new HashMap(); + sdkTypes.put(sdkType, keyword); + } + + public String getName(Sdk sdk) + { + if ( sdk != null && sdkTypes.containsKey(sdk.getSdkType().getName()) ) { + return sdkTypes.get(sdk.getSdkType().getName()); + } + + return defaultKeyword; + } +} \ No newline at end of file From d7c581b8e0a957b2ab4b877241ec7eb70730a3c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Wed, 4 Jun 2014 02:34:57 +0200 Subject: [PATCH 41/97] fix exclude sdk logic --- src/de/dreamlab/dash/keywords/ExcludeSdkTypeKeyword.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/dreamlab/dash/keywords/ExcludeSdkTypeKeyword.java b/src/de/dreamlab/dash/keywords/ExcludeSdkTypeKeyword.java index 8af9ab1..4219357 100644 --- a/src/de/dreamlab/dash/keywords/ExcludeSdkTypeKeyword.java +++ b/src/de/dreamlab/dash/keywords/ExcludeSdkTypeKeyword.java @@ -12,7 +12,7 @@ public ExcludeSdkTypeKeyword(String keyword, String sdkType) { } public String getName(Sdk sdk) { - if ( sdkType != null && !sdkType.equals(sdk.getSdkType().getName()) ) { + if ( sdkType == null || !sdkType.equals(sdk.getSdkType().getName()) ) { return keyword; } else { From afd929285254625db760227edf0ea648d9d895ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Wed, 4 Jun 2014 12:55:20 +0200 Subject: [PATCH 42/97] updated version number --- META-INF/plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 6d33df2..d83ff8a 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,7 +1,7 @@ com.paperetto.dash Dash - 3.0.1 + 3.1 beta 1 Gerard Delmàs Date: Fri, 6 Jun 2014 13:04:24 +0200 Subject: [PATCH 43/97] update readme troubleshooting more clear #13 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 156f555..2467e9a 100644 --- a/README.md +++ b/README.md @@ -14,5 +14,5 @@ The default shortcut assigned in the plugin is **Mac-Shift-D**. It either uses the current selection for the search, or the caret position. The plugin will identify the currently used programming language through context and request filtered search results accordingly. ## Troubleshooting -######The installation from the repositories does not work +######In rare conditions the installation from the repositories does not work It looks like there is an IntelliJ/Java bug with OS X Mavericks which prevents to install plugins from the repositories. Please install the plugin manually from [here](https://github.com/gdelmas/IntelliJDashPlugin/releases). For additional information check [issue #13](https://github.com/gdelmas/IntelliJDashPlugin/issues/13). From 414371958c4a618647c4b6595a8025b8c9055570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sun, 29 Jun 2014 02:23:14 +0200 Subject: [PATCH 44/97] fixed typo --- src/de/dreamlab/dash/DashLauncherAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/dreamlab/dash/DashLauncherAction.java b/src/de/dreamlab/dash/DashLauncherAction.java index 0b997f5..dd62bb6 100644 --- a/src/de/dreamlab/dash/DashLauncherAction.java +++ b/src/de/dreamlab/dash/DashLauncherAction.java @@ -84,7 +84,7 @@ public void actionPerformed(AnActionEvent e) { } if ( language != null && !language.getID().equals(resolvedLanguage) ) { - messageBuilder.append(String.format(" Based on \"%s\" context.", language.getID())); + messageBuilder.append(String.format(". Based on \"%s\" context.", language.getID())); } Project project = e.getProject(); From 76da67e07e15693faec964c198a2776158429ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sun, 29 Jun 2014 04:03:12 +0200 Subject: [PATCH 45/97] added injected language detection #24 --- src/de/dreamlab/dash/DashLauncherAction.java | 31 +++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/de/dreamlab/dash/DashLauncherAction.java b/src/de/dreamlab/dash/DashLauncherAction.java index dd62bb6..8b3620e 100644 --- a/src/de/dreamlab/dash/DashLauncherAction.java +++ b/src/de/dreamlab/dash/DashLauncherAction.java @@ -2,13 +2,11 @@ import com.intellij.lang.Language; +import com.intellij.lang.injection.InjectedLanguageManager; import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; import com.intellij.notification.Notifications; -import com.intellij.openapi.actionSystem.AnAction; -import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.LangDataKeys; -import com.intellij.openapi.actionSystem.PlatformDataKeys; +import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.SelectionModel; import com.intellij.openapi.module.Module; @@ -22,6 +20,13 @@ import com.intellij.psi.PsiComment; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; +import com.intellij.psi.PsiLanguageInjectionHost; +import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; + +import java.beans.BeanInfo; +import java.beans.IntrospectionException; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; public class DashLauncherAction extends AnAction { private static final String XML_LANGUAGE_ID = "XML"; @@ -46,12 +51,26 @@ public void actionPerformed(AnActionEvent e) { return; } + final Project project = e.getProject(); final PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE); PsiElement psiElement = null; Language language = null; if ( psiFile != null ) { - psiElement = psiFile.findElementAt(editor.getCaretModel().getOffset()); + int caretOffset = editor.getCaretModel().getOffset(); + + if ( project != null ) { + InjectedLanguageManager injectedLanguageManager = InjectedLanguageManager.getInstance(e.getProject()); + + if ( injectedLanguageManager != null ) { + psiElement = injectedLanguageManager.findInjectedElementAt(psiFile, caretOffset); + } + } + + if ( psiElement == null ) { + psiElement = psiFile.findElementAt(editor.getCaretModel().getOffset()); + } + language = elementLanguage(psiElement); } @@ -87,8 +106,6 @@ public void actionPerformed(AnActionEvent e) { messageBuilder.append(String.format(". Based on \"%s\" context.", language.getID())); } - Project project = e.getProject(); - if ( project != null ) { StatusBarUtil.setStatusBarInfo(project, messageBuilder.toString()); } From 53d95f0049c3274a011db7b14b7d77625367f2b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sun, 29 Jun 2014 04:05:18 +0200 Subject: [PATCH 46/97] cleaned up imports --- src/de/dreamlab/dash/DashLauncherAction.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/de/dreamlab/dash/DashLauncherAction.java b/src/de/dreamlab/dash/DashLauncherAction.java index 8b3620e..52e5bd4 100644 --- a/src/de/dreamlab/dash/DashLauncherAction.java +++ b/src/de/dreamlab/dash/DashLauncherAction.java @@ -6,7 +6,10 @@ import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; import com.intellij.notification.Notifications; -import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.LangDataKeys; +import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.SelectionModel; import com.intellij.openapi.module.Module; @@ -20,13 +23,6 @@ import com.intellij.psi.PsiComment; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; -import com.intellij.psi.PsiLanguageInjectionHost; -import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; - -import java.beans.BeanInfo; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; public class DashLauncherAction extends AnAction { private static final String XML_LANGUAGE_ID = "XML"; From 6f5d31054fd8eb6bae27c2cd27405512f4f88fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sun, 29 Jun 2014 05:54:50 +0200 Subject: [PATCH 47/97] generic sql will get mapped to docset specified through "SQL Dialects" project setting #24 --- Dash.iml | 3 +- META-INF/plugin.xml | 1 + src/de/dreamlab/dash/DashLauncherAction.java | 4 +- src/de/dreamlab/dash/KeywordLookup.java | 16 ++++-- .../dash/keywords/ExcludeSdkTypeKeyword.java | 5 +- src/de/dreamlab/dash/keywords/IKeyword.java | 5 +- src/de/dreamlab/dash/keywords/Keyword.java | 5 +- .../dash/keywords/SdkTypeSpecificKeyword.java | 5 +- .../keywords/SqlDialectDependentKeyword.java | 55 +++++++++++++++++++ 9 files changed, 87 insertions(+), 12 deletions(-) create mode 100644 src/de/dreamlab/dash/keywords/SqlDialectDependentKeyword.java diff --git a/Dash.iml b/Dash.iml index b2f3591..4db095a 100644 --- a/Dash.iml +++ b/Dash.iml @@ -6,8 +6,9 @@ - + + diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index d83ff8a..55d4895 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -28,6 +28,7 @@ The plugin will identify the currently used programming language through context com.intellij.modules.lang + com.intellij.sql diff --git a/src/de/dreamlab/dash/DashLauncherAction.java b/src/de/dreamlab/dash/DashLauncherAction.java index 52e5bd4..0c56e38 100644 --- a/src/de/dreamlab/dash/DashLauncherAction.java +++ b/src/de/dreamlab/dash/DashLauncherAction.java @@ -49,6 +49,8 @@ public void actionPerformed(AnActionEvent e) { final Project project = e.getProject(); final PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE); + final VirtualFile virtualFile = e.getData(LangDataKeys.VIRTUAL_FILE); + PsiElement psiElement = null; Language language = null; @@ -107,7 +109,7 @@ public void actionPerformed(AnActionEvent e) { } // open dash - dashLauncher.search(keywordLookup.findKeywords(language, getSdk(e, psiElement)), query); + dashLauncher.search(keywordLookup.findKeywords(language, getSdk(e, psiElement), project, psiFile, virtualFile), query); /* use the following command to display information about the sdk in use in the event log. intended for development purposes. diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index da2eded..4897f00 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -4,11 +4,11 @@ import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; import com.intellij.notification.Notifications; +import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; -import de.dreamlab.dash.keywords.ExcludeSdkTypeKeyword; -import de.dreamlab.dash.keywords.IKeyword; -import de.dreamlab.dash.keywords.Keyword; -import de.dreamlab.dash.keywords.SdkTypeSpecificKeyword; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiFile; +import de.dreamlab.dash.keywords.*; import java.util.*; @@ -65,6 +65,10 @@ public KeywordLookup() setLanguage("SmartyConfig", "smarty"); // PhpStorm setLanguage("Twig", "twig"); // PhpStorm + // SQL + setLanguage("SQL", new SqlDialectDependentKeyword("mysql", "mysql", "sqlite", "psql")); + setLanguage("PostgreSQL", "psql"); + // Jetbrains Plugins setLanguage("Haskell", "haskell"); setLanguage("Scala", "scala", "akka", "playscala"); @@ -145,14 +149,14 @@ public String findLanguageName(Language language) return null; } - public List findKeywords(Language language, Sdk sdk) + public List findKeywords(Language language, Sdk sdk, final Project project, final PsiFile psiFile, final VirtualFile virtualFile) { ArrayList result = new ArrayList(); String languageName = findLanguageName(language); if ( languageName != null ) { for ( IKeyword keyword : languageMap.get(languageName) ) { - String name = keyword.getName(sdk); + String name = keyword.getName(sdk, project, psiFile, virtualFile); if ( name != null ) { result.add(name); diff --git a/src/de/dreamlab/dash/keywords/ExcludeSdkTypeKeyword.java b/src/de/dreamlab/dash/keywords/ExcludeSdkTypeKeyword.java index 4219357..5278a40 100644 --- a/src/de/dreamlab/dash/keywords/ExcludeSdkTypeKeyword.java +++ b/src/de/dreamlab/dash/keywords/ExcludeSdkTypeKeyword.java @@ -1,6 +1,9 @@ package de.dreamlab.dash.keywords; +import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiFile; public class ExcludeSdkTypeKeyword implements IKeyword { private String keyword; @@ -11,7 +14,7 @@ public ExcludeSdkTypeKeyword(String keyword, String sdkType) { this.sdkType = sdkType; } - public String getName(Sdk sdk) { + public String getName(Sdk sdk, final Project project, final PsiFile psiFile, final VirtualFile virtualFile) { if ( sdkType == null || !sdkType.equals(sdk.getSdkType().getName()) ) { return keyword; } diff --git a/src/de/dreamlab/dash/keywords/IKeyword.java b/src/de/dreamlab/dash/keywords/IKeyword.java index 100b0cb..bcc4d89 100644 --- a/src/de/dreamlab/dash/keywords/IKeyword.java +++ b/src/de/dreamlab/dash/keywords/IKeyword.java @@ -1,9 +1,12 @@ package de.dreamlab.dash.keywords; +import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiFile; import com.sun.istack.internal.Nullable; public interface IKeyword { @Nullable - public String getName(Sdk sdk); + public String getName(Sdk sdk, final Project project, final PsiFile psiFile, final VirtualFile virtualFile); } diff --git a/src/de/dreamlab/dash/keywords/Keyword.java b/src/de/dreamlab/dash/keywords/Keyword.java index 8cbf8bd..e4cfddc 100644 --- a/src/de/dreamlab/dash/keywords/Keyword.java +++ b/src/de/dreamlab/dash/keywords/Keyword.java @@ -1,6 +1,9 @@ package de.dreamlab.dash.keywords; +import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiFile; public class Keyword implements IKeyword { private String keyword; @@ -9,7 +12,7 @@ public Keyword(String keyword) { this.keyword = keyword; } - public String getName(Sdk sdk) { + public String getName(Sdk sdk, final Project project, final PsiFile psiFile, final VirtualFile virtualFile) { return keyword; } } diff --git a/src/de/dreamlab/dash/keywords/SdkTypeSpecificKeyword.java b/src/de/dreamlab/dash/keywords/SdkTypeSpecificKeyword.java index 1fa67a3..22b95a9 100644 --- a/src/de/dreamlab/dash/keywords/SdkTypeSpecificKeyword.java +++ b/src/de/dreamlab/dash/keywords/SdkTypeSpecificKeyword.java @@ -1,6 +1,9 @@ package de.dreamlab.dash.keywords; +import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiFile; import java.util.HashMap; @@ -28,7 +31,7 @@ public SdkTypeSpecificKeyword(String keyword, String sdkType) { sdkTypes.put(sdkType, keyword); } - public String getName(Sdk sdk) + public String getName(Sdk sdk, final Project project, final PsiFile psiFile, final VirtualFile virtualFile) { if ( sdk != null && sdkTypes.containsKey(sdk.getSdkType().getName()) ) { return sdkTypes.get(sdk.getSdkType().getName()); diff --git a/src/de/dreamlab/dash/keywords/SqlDialectDependentKeyword.java b/src/de/dreamlab/dash/keywords/SqlDialectDependentKeyword.java new file mode 100644 index 0000000..e2e5a48 --- /dev/null +++ b/src/de/dreamlab/dash/keywords/SqlDialectDependentKeyword.java @@ -0,0 +1,55 @@ +package de.dreamlab.dash.keywords; + +import com.intellij.lang.Language; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiFile; + +import java.util.HashMap; + +public class SqlDialectDependentKeyword implements IKeyword { + private HashMap languageMap; + + public SqlDialectDependentKeyword(String defaultKeyword, String mySqlKeyword, String sqliteKeyword, String postgreSqlKeyword) { + languageMap = new HashMap(); + + languageMap.put("SQL", defaultKeyword); + languageMap.put("MySQL", mySqlKeyword); + languageMap.put("SQLite", sqliteKeyword); + languageMap.put("PostgreSQL", postgreSqlKeyword); + } + + @Override + public String getName(Sdk sdk, Project project, PsiFile psiFile, VirtualFile virtualFile) { + Language fileSqlLanguage = null; + + try { + Class.forName("com.intellij.sql.dialects.SqlDialectMappings"); + fileSqlLanguage = com.intellij.sql.dialects.SqlDialectMappings.getMapping(project, virtualFile); + } + catch (ClassNotFoundException e) { + } + + if ( fileSqlLanguage != null ) { + return languageMap.get(findLanguageName(fileSqlLanguage)); + } + else { + return null; + } + } + + public String findLanguageName(Language language) + { + while ( language != null ) { + if ( languageMap.containsKey(language.getID()) ) { + return language.getID(); + } + + language = language.getBaseLanguage(); + } + + return null; + } + +} From 3338264527364ed850d2b6387ef086bd6701415a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sun, 29 Jun 2014 17:08:45 +0200 Subject: [PATCH 48/97] updated description --- META-INF/plugin.xml | 15 ++++++++++----- README.md | 8 +++++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 55d4895..eded43a 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -5,13 +5,18 @@ Gerard Delmàs -The default shortcut assigned in the plugin is Mac-Shift-D.
+
Flattr this
-Dash is a Mac OSX utility that can be obtained here.

-The plugin will identify the currently used programming language through context and request filtered search results accordingly. - ]]> +A simple and intelligent plugin for the IntelliJ Platform (IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm, Android Studio) that provides keyboard shortcut access for Dash. +
+

Usage

+The default shortcut assigned in the plugin is Mac-Shift-D. +It either uses the caret position for the search, or the current selection. The plugin will identify the currently used programming language through context and request filtered search results accordingly. +
+

Dash

+Dash is a Mac application for rapid search of developer documentation. There is a free, fully functional version with nags. It can be downloaded here.
+]]> diff --git a/README.md b/README.md index 2467e9a..f785970 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,19 @@ -A simple plugin for the IntelliJ Platform (IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm, Android Studio) that provides keyboard shortcut access to Dash. +A simple and intelligent plugin for the IntelliJ Platform (IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm, Android Studio) that provides keyboard shortcut access for Dash. ## Installation To install the plugin in your IntelliJ IDE go to Preferences -> Plugins -> Browse repositories and search for "Dash". +[![Flattr this](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/2558535/gdelmasIntelliJDashPlugin-on-GitHub) + **AppCode 1.x** users have to manually install this version of the plugin: https://github.com/gdelmas/IntelliJDashPlugin/releases/tag/2.2 ## Kapeli Dash -Dash is a Mac application for rapid search of developer documentation. It is free with nags to persuade you to pay and lose the nags. The free version is fully functional and super-useful. Get karma for buying and supporting the developer :) It can be downloaded here: +Dash is a Mac application for rapid search of developer documentation. There is a free, fully functional version with nags. It can be downloaded here: [http://kapeli.com/dash](http://kapeli.com/dash) ## Usage The default shortcut assigned in the plugin is **Mac-Shift-D**. -It either uses the current selection for the search, or the caret position. The plugin will identify the currently used programming language through context and request filtered search results accordingly. +It either uses the caret position for the search, or the current selection. The plugin will identify the currently used programming language through context and request filtered search results accordingly. ## Troubleshooting ######In rare conditions the installation from the repositories does not work From 00a643dbc6cde0198dfd3c4c9241888ae7234c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sun, 29 Jun 2014 22:16:03 +0200 Subject: [PATCH 49/97] refactored keyword lookup using dictionary with common values for each lookup. this way shared results between keywords only have to be computed once. --- src/de/dreamlab/dash/DashLauncherAction.java | 45 +-------- src/de/dreamlab/dash/KeywordLookup.java | 10 +- .../dreamlab/dash/LookupInfoDictionary.java | 98 +++++++++++++++++++ .../dash/keywords/AbstractSdkKeyword.java | 56 +++++++++++ .../dash/keywords/ExcludeSdkTypeKeyword.java | 15 +-- src/de/dreamlab/dash/keywords/IKeyword.java | 7 +- src/de/dreamlab/dash/keywords/Keyword.java | 7 +- .../dash/keywords/SdkTypeSpecificKeyword.java | 10 +- .../keywords/SqlDialectDependentKeyword.java | 32 +++--- 9 files changed, 198 insertions(+), 82 deletions(-) create mode 100644 src/de/dreamlab/dash/LookupInfoDictionary.java create mode 100644 src/de/dreamlab/dash/keywords/AbstractSdkKeyword.java diff --git a/src/de/dreamlab/dash/DashLauncherAction.java b/src/de/dreamlab/dash/DashLauncherAction.java index 0c56e38..189bf38 100644 --- a/src/de/dreamlab/dash/DashLauncherAction.java +++ b/src/de/dreamlab/dash/DashLauncherAction.java @@ -12,17 +12,14 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.SelectionModel; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.roots.ModuleRootManager; -import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.impl.status.StatusBarUtil; import com.intellij.psi.PsiComment; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; +import de.dreamlab.dash.keywords.AbstractSdkKeyword; public class DashLauncherAction extends AnAction { private static final String XML_LANGUAGE_ID = "XML"; @@ -109,51 +106,15 @@ public void actionPerformed(AnActionEvent e) { } // open dash - dashLauncher.search(keywordLookup.findKeywords(language, getSdk(e, psiElement), project, psiFile, virtualFile), query); + dashLauncher.search(keywordLookup.findKeywords(new LookupInfoDictionary(language, psiElement, project, psiFile, virtualFile)), query); /* use the following command to display information about the sdk in use in the event log. intended for development purposes. - showSdkDebug(getSdk(e, psiElement)); + showSdkDebug(AbstractSdkKeyword.findSdk(psiElement, project, psiFile, virtualFile)); */ } } - private Sdk getSdk(AnActionEvent actionEvent, PsiElement psiElement) - { - final PsiFile psiFile = actionEvent.getData(LangDataKeys.PSI_FILE); - final Project project = actionEvent.getProject(); - Module module = null; - - if ( psiFile != null ) { - module = ModuleUtil.findModuleForPsiElement(psiFile); - - // Get the module associated with the PsiElement, if one is present. - if (module == null && psiElement != null) { - module = ModuleUtil.findModuleForPsiElement(psiElement); - } - } - - // Get the module associated with the VIRTUAL_FILE, if one is present. - if ( module == null ) { - final VirtualFile virtualFile = actionEvent.getData(LangDataKeys.VIRTUAL_FILE); - - if ( virtualFile != null && project != null ) { - module = ModuleUtil.findModuleForFile(virtualFile, project); - } - } - - // Get the SDK associated with the previously found module, or use the project-wide SDK if no module has been found. - if ( module != null ) { - return ModuleRootManager.getInstance(module).getSdk(); - } - else if ( project != null) { - return ProjectRootManager.getInstance(project).getProjectSdk(); - } - else { - return null; - } - } - private void showSdkDebug(Sdk sdk) { StringBuilder sdkMessage = new StringBuilder(); diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 4897f00..3dde7f3 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -4,10 +4,6 @@ import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; import com.intellij.notification.Notifications; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.psi.PsiFile; import de.dreamlab.dash.keywords.*; import java.util.*; @@ -149,14 +145,14 @@ public String findLanguageName(Language language) return null; } - public List findKeywords(Language language, Sdk sdk, final Project project, final PsiFile psiFile, final VirtualFile virtualFile) + public List findKeywords(final LookupInfoDictionary dict) { ArrayList result = new ArrayList(); - String languageName = findLanguageName(language); + String languageName = findLanguageName(dict.getLanguage()); if ( languageName != null ) { for ( IKeyword keyword : languageMap.get(languageName) ) { - String name = keyword.getName(sdk, project, psiFile, virtualFile); + String name = keyword.getName(dict); if ( name != null ) { result.add(name); diff --git a/src/de/dreamlab/dash/LookupInfoDictionary.java b/src/de/dreamlab/dash/LookupInfoDictionary.java new file mode 100644 index 0000000..dd47923 --- /dev/null +++ b/src/de/dreamlab/dash/LookupInfoDictionary.java @@ -0,0 +1,98 @@ +package de.dreamlab.dash; + +import com.intellij.lang.Language; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; + +public class LookupInfoDictionary{ + private Language language; + private PsiElement psiElement; + private Project project; + private PsiFile psiFile; + private VirtualFile virtualFile; + + private boolean isSdk = false; + private Sdk sdk = null; + + private boolean isFileSqlLanguage = false; + private Language fileSqlLanguage; + + + public LookupInfoDictionary(Language language, PsiElement psiElement, Project project, PsiFile psiFile, VirtualFile virtualFile) { + this.language = language; + this.psiElement = psiElement; + this.project = project; + this.psiFile = psiFile; + this.virtualFile = virtualFile; + } + + // initially set values + public Language getLanguage() { + return language; + } + + public PsiElement getPsiElement() { + return psiElement; + } + + public Project getProject() { + return project; + } + + public PsiFile getPsiFile() { + return psiFile; + } + + public VirtualFile getVirtualFile() { + return virtualFile; + } + + // optional sdk value + public boolean isSdk() { + return isSdk; + } + + public Sdk getSdk() { + if ( !isSdk) { + throw new Error("sdk has not been set"); + } + + return sdk; + } + + public void setSdk(Sdk sdk) { + if (isSdk) { + throw new Error("sdk can only be set once"); + } + + this.sdk = sdk; + this.isSdk = true; + } + + // optional fileSqlLanguage value + public boolean isFileSqlLanguage() { + return isFileSqlLanguage; + } + + public Language getFileSqlLanguage() { + if ( !isFileSqlLanguage) { + throw new Error("fileSqlLanguage has not been set"); + } + + return fileSqlLanguage; + } + + public void setFileSqlLanguage(Language fileSqlLanguage) { + if (isFileSqlLanguage) { + throw new Error("fileSqlLanguage can only be set once"); + } + + this.fileSqlLanguage = fileSqlLanguage; + this.isFileSqlLanguage = true; + } + + +} diff --git a/src/de/dreamlab/dash/keywords/AbstractSdkKeyword.java b/src/de/dreamlab/dash/keywords/AbstractSdkKeyword.java new file mode 100644 index 0000000..9d79e8c --- /dev/null +++ b/src/de/dreamlab/dash/keywords/AbstractSdkKeyword.java @@ -0,0 +1,56 @@ +package de.dreamlab.dash.keywords; + +import com.intellij.openapi.module.Module; +import com.intellij.openapi.module.ModuleUtil; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.roots.ModuleRootManager; +import com.intellij.openapi.roots.ProjectRootManager; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; +import de.dreamlab.dash.LookupInfoDictionary; + +public abstract class AbstractSdkKeyword { + + protected Sdk getSdk(LookupInfoDictionary dict) + { + if ( !dict.isSdk() ) { + dict.setSdk(findSdk(dict.getPsiElement(), dict.getProject(), dict.getPsiFile(), dict.getVirtualFile())); + } + + return dict.getSdk(); + } + + public static Sdk findSdk(final PsiElement psiElement, final Project project, final PsiFile psiFile, final VirtualFile virtualFile) + { + Module module = null; + + if ( psiFile != null ) { + module = ModuleUtil.findModuleForPsiElement(psiFile); + + // Get the module associated with the PsiElement, if one is present. + if (module == null && psiElement != null) { + module = ModuleUtil.findModuleForPsiElement(psiElement); + } + } + + // Get the module associated with the VIRTUAL_FILE, if one is present. + if ( module == null ) { + if ( virtualFile != null && project != null ) { + module = ModuleUtil.findModuleForFile(virtualFile, project); + } + } + + // Get the SDK associated with the previously found module, or use the project-wide SDK if no module has been found. + if ( module != null ) { + return ModuleRootManager.getInstance(module).getSdk(); + } + else if ( project != null) { + return ProjectRootManager.getInstance(project).getProjectSdk(); + } + else { + return null; + } + } +} diff --git a/src/de/dreamlab/dash/keywords/ExcludeSdkTypeKeyword.java b/src/de/dreamlab/dash/keywords/ExcludeSdkTypeKeyword.java index 5278a40..f89caf3 100644 --- a/src/de/dreamlab/dash/keywords/ExcludeSdkTypeKeyword.java +++ b/src/de/dreamlab/dash/keywords/ExcludeSdkTypeKeyword.java @@ -1,11 +1,9 @@ package de.dreamlab.dash.keywords; -import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.psi.PsiFile; +import de.dreamlab.dash.LookupInfoDictionary; -public class ExcludeSdkTypeKeyword implements IKeyword { +public class ExcludeSdkTypeKeyword extends AbstractSdkKeyword implements IKeyword { private String keyword; private String sdkType; @@ -14,8 +12,13 @@ public ExcludeSdkTypeKeyword(String keyword, String sdkType) { this.sdkType = sdkType; } - public String getName(Sdk sdk, final Project project, final PsiFile psiFile, final VirtualFile virtualFile) { - if ( sdkType == null || !sdkType.equals(sdk.getSdkType().getName()) ) { + public String getName(final LookupInfoDictionary dict) { + Sdk sdk = getSdk(dict); + + if ( sdkType == null ) { + return null; + } + else if ( sdk != null && !sdkType.equals(sdk.getSdkType().getName()) ) { return keyword; } else { diff --git a/src/de/dreamlab/dash/keywords/IKeyword.java b/src/de/dreamlab/dash/keywords/IKeyword.java index bcc4d89..e188261 100644 --- a/src/de/dreamlab/dash/keywords/IKeyword.java +++ b/src/de/dreamlab/dash/keywords/IKeyword.java @@ -1,12 +1,9 @@ package de.dreamlab.dash.keywords; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.psi.PsiFile; import com.sun.istack.internal.Nullable; +import de.dreamlab.dash.LookupInfoDictionary; public interface IKeyword { @Nullable - public String getName(Sdk sdk, final Project project, final PsiFile psiFile, final VirtualFile virtualFile); + public String getName(final LookupInfoDictionary dict); } diff --git a/src/de/dreamlab/dash/keywords/Keyword.java b/src/de/dreamlab/dash/keywords/Keyword.java index e4cfddc..3766d8a 100644 --- a/src/de/dreamlab/dash/keywords/Keyword.java +++ b/src/de/dreamlab/dash/keywords/Keyword.java @@ -1,9 +1,6 @@ package de.dreamlab.dash.keywords; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.psi.PsiFile; +import de.dreamlab.dash.LookupInfoDictionary; public class Keyword implements IKeyword { private String keyword; @@ -12,7 +9,7 @@ public Keyword(String keyword) { this.keyword = keyword; } - public String getName(Sdk sdk, final Project project, final PsiFile psiFile, final VirtualFile virtualFile) { + public String getName(final LookupInfoDictionary dict) { return keyword; } } diff --git a/src/de/dreamlab/dash/keywords/SdkTypeSpecificKeyword.java b/src/de/dreamlab/dash/keywords/SdkTypeSpecificKeyword.java index 22b95a9..c7e8984 100644 --- a/src/de/dreamlab/dash/keywords/SdkTypeSpecificKeyword.java +++ b/src/de/dreamlab/dash/keywords/SdkTypeSpecificKeyword.java @@ -1,14 +1,12 @@ package de.dreamlab.dash.keywords; -import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.psi.PsiFile; +import de.dreamlab.dash.LookupInfoDictionary; import java.util.HashMap; -public class SdkTypeSpecificKeyword implements IKeyword { +public class SdkTypeSpecificKeyword extends AbstractSdkKeyword implements IKeyword { private String defaultKeyword = null; private HashMap sdkTypes; @@ -31,8 +29,10 @@ public SdkTypeSpecificKeyword(String keyword, String sdkType) { sdkTypes.put(sdkType, keyword); } - public String getName(Sdk sdk, final Project project, final PsiFile psiFile, final VirtualFile virtualFile) + public String getName(final LookupInfoDictionary dict) { + Sdk sdk = getSdk(dict); + if ( sdk != null && sdkTypes.containsKey(sdk.getSdkType().getName()) ) { return sdkTypes.get(sdk.getSdkType().getName()); } diff --git a/src/de/dreamlab/dash/keywords/SqlDialectDependentKeyword.java b/src/de/dreamlab/dash/keywords/SqlDialectDependentKeyword.java index e2e5a48..3abebb0 100644 --- a/src/de/dreamlab/dash/keywords/SqlDialectDependentKeyword.java +++ b/src/de/dreamlab/dash/keywords/SqlDialectDependentKeyword.java @@ -1,10 +1,7 @@ package de.dreamlab.dash.keywords; import com.intellij.lang.Language; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.psi.PsiFile; +import de.dreamlab.dash.LookupInfoDictionary; import java.util.HashMap; @@ -21,16 +18,13 @@ public SqlDialectDependentKeyword(String defaultKeyword, String mySqlKeyword, St } @Override - public String getName(Sdk sdk, Project project, PsiFile psiFile, VirtualFile virtualFile) { - Language fileSqlLanguage = null; - - try { - Class.forName("com.intellij.sql.dialects.SqlDialectMappings"); - fileSqlLanguage = com.intellij.sql.dialects.SqlDialectMappings.getMapping(project, virtualFile); - } - catch (ClassNotFoundException e) { + public String getName(final LookupInfoDictionary dict) { + if ( !dict.isFileSqlLanguage() ) { + setDictFileSqlLanguage(dict); } + Language fileSqlLanguage = dict.getFileSqlLanguage(); + if ( fileSqlLanguage != null ) { return languageMap.get(findLanguageName(fileSqlLanguage)); } @@ -52,4 +46,18 @@ public String findLanguageName(Language language) return null; } + private void setDictFileSqlLanguage(LookupInfoDictionary dict) + { + Language language = null; + + try { + Class.forName("com.intellij.sql.dialects.SqlDialectMappings"); + language = com.intellij.sql.dialects.SqlDialectMappings.getMapping(dict.getProject(), dict.getVirtualFile()); + } + catch (ClassNotFoundException e) { + } + + dict.setFileSqlLanguage(language); + } + } From d6a37b973b63e2860768951f0e008525f4d9514f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Mon, 30 Jun 2014 00:52:53 +0200 Subject: [PATCH 50/97] java sdk version detection #23 --- src/de/dreamlab/dash/KeywordLookup.java | 7 ++-- .../JavaSdkVersionDependentKeyword.java | 39 +++++++++++++++++++ 2 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 src/de/dreamlab/dash/keywords/JavaSdkVersionDependentKeyword.java diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 3dde7f3..ae20c9d 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -36,6 +36,7 @@ public KeywordLookup() setLanguage("SQLite", "sqlite"); // not WebStorm // Products listed for each entry + final IKeyword javaVersionedKeyword = new JavaSdkVersionDependentKeyword("java6", "java7", "java8"); final IKeyword javaKeyword = new SdkTypeSpecificKeyword("java", "Android SDK", "android"); final IKeyword javaFxKeyword = new ExcludeSdkTypeKeyword("javafx", "Android SDK"); final IKeyword grailsKeyword = new ExcludeSdkTypeKeyword("grails", "Android SDK"); @@ -47,10 +48,10 @@ public KeywordLookup() setLanguage("DjangoTemplate", "django"); // PyCharm setLanguage("Groovy", "groovy"); // IntelliJ setLanguage("Jade", "jade"); // WebStorm - setLanguage("JAVA", javaKeyword, javaFxKeyword, grailsKeyword, groovyKeyword, playjavaKeyword, springKeyword, "cvj", "processing", "javadoc"); // IntelliJ + setLanguage("JAVA", javaVersionedKeyword, javaKeyword, javaFxKeyword, grailsKeyword, groovyKeyword, playjavaKeyword, springKeyword, "cvj", "processing", "javadoc"); // IntelliJ setLanguage("JsInJade", "javascript", "jade"); // WebStorm - setLanguage("JSP", javaKeyword, javaFxKeyword, grailsKeyword, groovyKeyword, playjavaKeyword, springKeyword, "cvj", "javadoc"); // IntelliJ, WebStorm, PhpStorm - setLanguage("JSPX", javaKeyword, javaFxKeyword, grailsKeyword, groovyKeyword, playjavaKeyword, springKeyword, "cvj", "javadoc"); // IntelliJ, WebStorm, PhpStorm + setLanguage("JSP", javaVersionedKeyword, javaKeyword, javaFxKeyword, grailsKeyword, groovyKeyword, playjavaKeyword, springKeyword, "cvj", "javadoc"); // IntelliJ, WebStorm, PhpStorm + setLanguage("JSPX", javaVersionedKeyword, javaKeyword, javaFxKeyword, grailsKeyword, groovyKeyword, playjavaKeyword, springKeyword, "cvj", "javadoc"); // IntelliJ, WebStorm, PhpStorm setLanguage("Mxml", "actionscript"); // IntelliJ setLanguage("PHP", "php", "wordpress", "drupal", "zend", "laravel", "yii", "joomla", "ee", "codeigniter", "cakephp", "phpunit", "symfony", "typo3", "twig", "smarty", "phpp"); // PhpStorm setLanguage("Play", "playjava"); // IntelliJ; uncertain diff --git a/src/de/dreamlab/dash/keywords/JavaSdkVersionDependentKeyword.java b/src/de/dreamlab/dash/keywords/JavaSdkVersionDependentKeyword.java new file mode 100644 index 0000000..cc616c6 --- /dev/null +++ b/src/de/dreamlab/dash/keywords/JavaSdkVersionDependentKeyword.java @@ -0,0 +1,39 @@ +package de.dreamlab.dash.keywords; + +import com.intellij.openapi.projectRoots.Sdk; +import de.dreamlab.dash.LookupInfoDictionary; + +public class JavaSdkVersionDependentKeyword extends AbstractSdkKeyword implements IKeyword { + private String java6Keyword; + private String java7Keyword; + private String java8Keyword; + + public JavaSdkVersionDependentKeyword(String java6Keyword, String java7Keyword, String java8Keyword) { + this.java6Keyword = java6Keyword; + this.java7Keyword = java7Keyword; + this.java8Keyword = java8Keyword; + } + + @Override + public String getName(LookupInfoDictionary dict) { + Sdk sdk = getSdk(dict); + + if ( sdk != null && sdk.getSdkType().getName().equals("JavaSDK") ) { + String versionString = sdk.getVersionString(); + + if ( versionString != null ) { + if ( versionString.contains("1.6.") ) { + return java6Keyword; + } + else if ( versionString.contains("1.7.") ) { + return java7Keyword; + } + else if ( versionString.contains("1.8.") ) { + return java8Keyword; + } + } + } + + return null; + } +} From 75e63dd9ba05130ffae80660a722b11d7af8e12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Mon, 30 Jun 2014 01:17:16 +0200 Subject: [PATCH 51/97] python sdk version detection #23 --- src/de/dreamlab/dash/KeywordLookup.java | 2 +- .../PythonSdkVersionDependentKeyword.java | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/de/dreamlab/dash/keywords/PythonSdkVersionDependentKeyword.java diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index ae20c9d..ceb440b 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -56,7 +56,7 @@ public KeywordLookup() setLanguage("PHP", "php", "wordpress", "drupal", "zend", "laravel", "yii", "joomla", "ee", "codeigniter", "cakephp", "phpunit", "symfony", "typo3", "twig", "smarty", "phpp"); // PhpStorm setLanguage("Play", "playjava"); // IntelliJ; uncertain setLanguage("Puppet", "puppet"); // RubyMine, PyCharm - setLanguage("Python", "python", "django", "twisted", "sphinx", "flask", "tornado", "sqlalchemy", "numpy", "scipy", "salt", "cvp"); // PyCharm + setLanguage("Python", new PythonSdkVersionDependentKeyword("python2", "python3"), "python", "django", "twisted", "sphinx", "flask", "tornado", "sqlalchemy", "numpy", "scipy", "salt", "cvp"); // PyCharm setLanguage("ruby", "ruby", "rubygems", "rails"); // RubyMine setLanguage("Smarty", "smarty"); // PhpStorm setLanguage("SmartyConfig", "smarty"); // PhpStorm diff --git a/src/de/dreamlab/dash/keywords/PythonSdkVersionDependentKeyword.java b/src/de/dreamlab/dash/keywords/PythonSdkVersionDependentKeyword.java new file mode 100644 index 0000000..46f433b --- /dev/null +++ b/src/de/dreamlab/dash/keywords/PythonSdkVersionDependentKeyword.java @@ -0,0 +1,34 @@ +package de.dreamlab.dash.keywords; + +import com.intellij.openapi.projectRoots.Sdk; +import de.dreamlab.dash.LookupInfoDictionary; + +public class PythonSdkVersionDependentKeyword extends AbstractSdkKeyword implements IKeyword { + private String python2Keyword; + private String python3Keyword; + + public PythonSdkVersionDependentKeyword(String python2Keyword, String python3Keyword) { + this.python2Keyword = python2Keyword; + this.python3Keyword = python3Keyword; + } + + @Override + public String getName(LookupInfoDictionary dict) { + Sdk sdk = getSdk(dict); + + if ( sdk != null && sdk.getSdkType().getName().equals("Python SDK") ) { + String versionString = sdk.getVersionString(); + + if ( versionString != null ) { + if ( versionString.contains("Python 2") ) { + return python2Keyword; + } + else if ( versionString.contains("Python 3") ) { + return python3Keyword; + } + } + } + + return null; + } +} From f7b8fec62191b6f4a752280a0ca4e2f983716f5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Mon, 30 Jun 2014 02:01:32 +0200 Subject: [PATCH 52/97] changed plugin version & changenotes --- META-INF/plugin.xml | 45 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index eded43a..a4182d1 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,14 +1,14 @@ com.paperetto.dash Dash - 3.1 beta 1 + 3.1 beta 2 Gerard Delmàs Flattr this +A simple and intelligent plugin for the IntelliJ Platform (IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm, Android Studio) that provides keyboard shortcut access for Dash.

-A simple and intelligent plugin for the IntelliJ Platform (IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm, Android Studio) that provides keyboard shortcut access for Dash. +Flattr this

Usage

The default shortcut assigned in the plugin is Mac-Shift-D. @@ -16,14 +16,43 @@ It either uses the caret position for the search, or the current selection. The

Dash

Dash is a Mac application for rapid search of developer documentation. There is a free, fully functional version with nags. It can be downloaded here.
+
+

What's new

+In the past months I have been adding and testing new features for the plugin. I am now happy to release a lot of these additions that will make your search results just better.
+
+From now on code in strings will be detected. This way it is no longer necessary to select a specific word, the plugin will automatically know what you want to look up by the caret position. A lot of strings contain SQL code and for these your results will only from a SQL docset. In Project Settings -> SQL Dialects you can set which SQL docset you want to search. There are docsets available for MySQL, PostgreSQL and SQLite.
+
+If you have the "Regular Expressions" cheatsheet installed in Dash you can lookup groups, quantifiers and special characters really quickly. Just try and check what /\v/ means.
+
+Android projects get results from the Android docs, not Java. Java results depend on the projects SDK setting, searching either Java 6, 7 or 8. The same goes for Python 2 or 3. Apart from that I added support for Bash, Go, Haskell, Lua, Markdown, Scala and TypoScript. Language support for JavaScript and others has been extended.
+
+Simplicity is really important to me, that's why I always try to keep the plugin smart and settings free. I hope this help you spend less time searching the reference. Make the best of it.
]]>
-3.0 Added Context aware search
-2.2 Compatibility and stability fixes
-2.1 Added Ruby syntax support, stability fixes
-2.0 Added Dash docset keyword support
+
+3.1
+    - language detection support in strings
+    - project settings sql dialect will be used
+      to filter search results
+    - android project support
+    - java search results according to projects
+      sdk version
+    - python search results according to
+      projects sdk version
+    - added language support for: Bash, Go,
+      Haskell, Lua, Markdown, Scala, TypoScript
+    - extended language support for: angularjs,
+      momen, require, awsjs, jasmine, sinon,
+      tornado, sqlalchemy, numpy, scipy, salt,
+      polymerdart, angulardart
+    - performance and stability improvements
+3.0.1 Fixed missing Ruby context recognition
+3.0   Added Context aware search
+2.2   Compatibility and stability fixes
+2.1   Added Ruby syntax support, stability fixes
+2.0   Added Dash docset keyword support
+
]]>
From 54cffde53c2daace831f2da23cbcdf28ebd2d3fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Tue, 1 Jul 2014 23:40:18 +0200 Subject: [PATCH 53/97] 3.1 release --- META-INF/plugin.xml | 41 ++++++++++++++++++----------------------- README.md | 28 ++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 31 deletions(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index a4182d1..4135f8a 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,32 +1,27 @@ com.paperetto.dash Dash - 3.1 beta 2 + 3.1 Gerard Delmàs -
-Flattr this -
-

Usage

-The default shortcut assigned in the plugin is Mac-Shift-D. -It either uses the caret position for the search, or the current selection. The plugin will identify the currently used programming language through context and request filtered search results accordingly. -
-

Dash

-Dash is a Mac application for rapid search of developer documentation. There is a free, fully functional version with nags. It can be downloaded here.
-
-

What's new

-In the past months I have been adding and testing new features for the plugin. I am now happy to release a lot of these additions that will make your search results just better.
-
-From now on code in strings will be detected. This way it is no longer necessary to select a specific word, the plugin will automatically know what you want to look up by the caret position. A lot of strings contain SQL code and for these your results will only from a SQL docset. In Project Settings -> SQL Dialects you can set which SQL docset you want to search. There are docsets available for MySQL, PostgreSQL and SQLite.
-
-If you have the "Regular Expressions" cheatsheet installed in Dash you can lookup groups, quantifiers and special characters really quickly. Just try and check what /\v/ means.
-
-Android projects get results from the Android docs, not Java. Java results depend on the projects SDK setting, searching either Java 6, 7 or 8. The same goes for Python 2 or 3. Apart from that I added support for Bash, Go, Haskell, Lua, Markdown, Scala and TypoScript. Language support for JavaScript and others has been extended.
-
-Simplicity is really important to me, that's why I always try to keep the plugin smart and settings free. I hope this help you spend less time searching the reference. Make the best of it.
+

A smart and simple plugin that provides keyboard shortcut access for Dash in IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm and Android Studio.

+

 

+

Flattr this

+ +

Usage

+

The default shortcut assigned in the plugin is Cmd-Shift-D.

+

It either uses the caret position for the search, or the current selection. The plugin will identify the currently used programming language and request filtered search results accordingly.

+ +

Kapeli Dash App

+

Dash is a Mac application for rapid search of developer documentation. There is a free, fully functional version with nags. It can be downloaded here.

+ +

What's new

+

In the past months I have been adding and testing new features for the plugin. I am now happy to release a lot of these additions that will make your search results just better.

+

From now on code in strings will be recognized. This way it is no longer necessary to select a specific word, the plugin will automatically know what you want to look up by the caret position. A lot of strings contain SQL code and for these your results will only be from a SQL docset. In Project Settings -> SQL Dialects you can set which SQL docset you want to search. There are docsets available for MySQL, PostgreSQL and SQLite.

+

If you have the "Regular Expressions" cheatsheet installed in Dash you can lookup groups, quantifiers and special characters really quickly. Just try and check what /\v/ stands for.

+

Android projects get results from the Android docs, not Java. Java results depend on the projects SDK setting, searching either Java 6, 7 or 8. The same goes for Python 2 or 3. Apart from that I added support for Bash, Go, Haskell, Lua, Markdown, Scala and TypoScript. Language support for JavaScript and others has been enhanced.

+

Simplicity is really important to me, that's why I always try to keep the plugin smart, simple and settings free. I hope this helps you spend less time searching the reference. Make the best of it.

]]>
Plugins -> Browse repositories and search for "Dash". +To install the plugin in your IDE go to Preferences -> Plugins -> Browse repositories and search for "Dash". [![Flattr this](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/2558535/gdelmasIntelliJDashPlugin-on-GitHub) -**AppCode 1.x** users have to manually install this version of the plugin: https://github.com/gdelmas/IntelliJDashPlugin/releases/tag/2.2 +## What's new +In the past months I have been adding and testing new features for the plugin. I am now happy to release a lot of these additions that will make your search results just better. -## Kapeli Dash -Dash is a Mac application for rapid search of developer documentation. There is a free, fully functional version with nags. It can be downloaded here: -[http://kapeli.com/dash](http://kapeli.com/dash) +From now on code in strings will be recognized. This way it is no longer necessary to select a specific word, the plugin will automatically know what you want to look up by the caret position. A lot of strings contain SQL code and for these your results will only be from a SQL docset. In Project Settings -> SQL Dialects you can set which SQL docset you want to search. There are docsets available for MySQL, PostgreSQL and SQLite. + +If you have the "Regular Expressions" cheatsheet installed in Dash you can lookup groups, quantifiers and special characters really quickly. Just try and check what /\v/ stands for. + +Android projects get results from the Android docs, not Java. Java results depend on the projects SDK setting, searching either Java 6, 7 or 8. The same goes for Python 2 or 3. Apart from that I added support for Bash, Go, Haskell, Lua, Markdown, Scala and TypoScript. Language support for JavaScript and others has been enhanced. + +Simplicity is really important to me, that's why I always try to keep the plugin smart, simple and settings free. I hope this helps you spend less time searching the reference. Make the best of it. ## Usage -The default shortcut assigned in the plugin is **Mac-Shift-D**. -It either uses the caret position for the search, or the current selection. The plugin will identify the currently used programming language through context and request filtered search results accordingly. +The default shortcut assigned in the plugin is **Cmd-Shift-D**. +It either uses the caret position for the search, or the current selection. The plugin will identify the currently used programming language and request filtered search results accordingly. + +## Kapeli Dash App +Dash is a Mac application for rapid search of developer documentation. There is a free, fully functional version with nags. It can be downloaded here: +[http://kapeli.com/dash](http://kapeli.com/dash) ## Troubleshooting +######The plugin does not work on old IDEs +Older IDE versions like **AppCode 1.x** are not supported anymore. Please manually install version 2.2 of the plugin: https://github.com/gdelmas/IntelliJDashPlugin/releases/tag/2.2 + ######In rare conditions the installation from the repositories does not work It looks like there is an IntelliJ/Java bug with OS X Mavericks which prevents to install plugins from the repositories. Please install the plugin manually from [here](https://github.com/gdelmas/IntelliJDashPlugin/releases). For additional information check [issue #13](https://github.com/gdelmas/IntelliJDashPlugin/issues/13). From b147941802ccdba72cc3b2b1c078a5690c4f34f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sat, 26 Jul 2014 02:46:40 +0200 Subject: [PATCH 54/97] fix #26 --- .../dash/keywords/SqlDialectDependentKeyword.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/de/dreamlab/dash/keywords/SqlDialectDependentKeyword.java b/src/de/dreamlab/dash/keywords/SqlDialectDependentKeyword.java index 3abebb0..662dd10 100644 --- a/src/de/dreamlab/dash/keywords/SqlDialectDependentKeyword.java +++ b/src/de/dreamlab/dash/keywords/SqlDialectDependentKeyword.java @@ -1,8 +1,11 @@ package de.dreamlab.dash.keywords; import com.intellij.lang.Language; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.vfs.VirtualFile; import de.dreamlab.dash.LookupInfoDictionary; +import java.lang.reflect.Method; import java.util.HashMap; public class SqlDialectDependentKeyword implements IKeyword { @@ -51,10 +54,13 @@ private void setDictFileSqlLanguage(LookupInfoDictionary dict) Language language = null; try { - Class.forName("com.intellij.sql.dialects.SqlDialectMappings"); - language = com.intellij.sql.dialects.SqlDialectMappings.getMapping(dict.getProject(), dict.getVirtualFile()); +// using reflection for the following command, because of optional dependencies +// language = com.intellij.sql.dialects.SqlDialectMappings.getMapping(dict.getProject(), dict.getVirtualFile()); + Class sqlClass = Class.forName("com.intellij.sql.dialects.SqlDialectMappings"); + Method getMappingMethod = sqlClass.getMethod("getMapping", Project.class, VirtualFile.class); + language = (Language)getMappingMethod.invoke(null, dict.getProject(), dict.getVirtualFile()); } - catch (ClassNotFoundException e) { + catch (Throwable e) { } dict.setFileSqlLanguage(language); From 06bfdde572cae3a3319e1337272b70a288ee36ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sat, 26 Jul 2014 04:15:41 +0200 Subject: [PATCH 55/97] cross platform support fixes #27 --- src/de/dreamlab/dash/DashLauncher.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/de/dreamlab/dash/DashLauncher.java b/src/de/dreamlab/dash/DashLauncher.java index a7a84c4..d5a7d0d 100644 --- a/src/de/dreamlab/dash/DashLauncher.java +++ b/src/de/dreamlab/dash/DashLauncher.java @@ -4,14 +4,13 @@ package de.dreamlab.dash; -import com.intellij.execution.ExecutionException; -import com.intellij.execution.configurations.GeneralCommandLine; -import com.intellij.execution.util.ExecUtil; import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; import com.intellij.notification.Notifications; +import java.awt.Desktop; import java.io.UnsupportedEncodingException; +import java.net.URI; import java.net.URLEncoder; import java.util.Collection; @@ -54,17 +53,15 @@ public void search(Collection keywords, String query) } } - private void openUri(String uri) + private void openUri(String uriStr) { try { - final GeneralCommandLine commandLine = new GeneralCommandLine(ExecUtil.getOpenCommandPath()); - commandLine.addParameter(uri); - commandLine.createProcess(); - + Desktop desktop = Desktop.getDesktop(); + URI uri = new URI(uriStr); + desktop.browse(uri); } - catch ( ExecutionException e ) { + catch (Throwable e) { Notifications.Bus.notify(new Notification("Dash Plugin Error", "Dash Plugin Error", e.getMessage(), NotificationType.ERROR)); - return; } } From 062c3d14df3acb6a4d1944407f315f3102554a0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Wed, 30 Jul 2014 05:02:47 +0200 Subject: [PATCH 56/97] fixed search term when no language was detected --- src/de/dreamlab/dash/DashLauncherAction.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/de/dreamlab/dash/DashLauncherAction.java b/src/de/dreamlab/dash/DashLauncherAction.java index 189bf38..6478b97 100644 --- a/src/de/dreamlab/dash/DashLauncherAction.java +++ b/src/de/dreamlab/dash/DashLauncherAction.java @@ -70,13 +70,14 @@ public void actionPerformed(AnActionEvent e) { } String query; + String resolvedLanguage = keywordLookup.findLanguageName(language); SelectionModel selectionModel = editor.getSelectionModel(); if ( selectionModel.hasSelection() ) { query = selectionModel.getSelectedText(); } else { - if ( psiElement == null || psiElement instanceof PsiComment ) { + if ( psiElement == null || psiElement instanceof PsiComment || resolvedLanguage == null ) { query = getWordAtCursor(editor); } else { @@ -86,8 +87,6 @@ public void actionPerformed(AnActionEvent e) { if ( query != null ) { // show status message for potential troubleshooting - String resolvedLanguage = keywordLookup.findLanguageName(language); - final StringBuilder messageBuilder = new StringBuilder(); if ( resolvedLanguage == null ) { From 0c067f242aac49aaeb99ab33dbc330c31c6adb50 Mon Sep 17 00:00:00 2001 From: Alex Schneider Date: Sun, 5 Oct 2014 10:29:56 -0700 Subject: [PATCH 57/97] Zeal support added --- src/de/dreamlab/dash/DashLauncher.java | 55 +++++++++++++++++--------- 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/src/de/dreamlab/dash/DashLauncher.java b/src/de/dreamlab/dash/DashLauncher.java index d5a7d0d..0ec1af8 100644 --- a/src/de/dreamlab/dash/DashLauncher.java +++ b/src/de/dreamlab/dash/DashLauncher.java @@ -9,10 +9,14 @@ import com.intellij.notification.Notifications; import java.awt.Desktop; +import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URLEncoder; +import java.util.Arrays; import java.util.Collection; +import java.util.LinkedList; +import java.util.List; public class DashLauncher { @@ -22,32 +26,47 @@ public DashLauncher() { public void search(Collection keywords, String query) { try { - String request = "dash-plugin://"; + if ( System.getProperty("os.name").equals("Linux") ) { + List command = Arrays.asList("zeal", "--query"); + StringBuilder queryString = new StringBuilder(); + if (keywords.size() > 0) { + // Zeal only supports searches with one keyword. Until that + // limitation is fixed, we can only search for the first keyword. + String keyword = keywords.iterator().next(); + queryString.append(keyword); + queryString.append(":"); + } + queryString.append(query); + ProcessBuilder pb = new ProcessBuilder("zeal", "--query", queryString.toString()); + pb.start(); + } else { + String request = "dash-plugin://"; - // keywords - if (keywords.size() > 0) { - request += "keys="; - int i = 0; + // keywords + if (keywords.size() > 0) { + request += "keys="; + int i = 0; - for (String keyword : keywords) { - if (i > 0) { - request += ','; - } + for (String keyword : keywords) { + if (i > 0) { + request += ','; + } - request += urlEncode(keyword); + request += urlEncode(keyword); - i++; - } + i++; + } - request += "&"; - } + request += "&"; + } - // query - request += "query=" + urlEncode(query); + // query + request += "query=" + urlEncode(query); - openUri(request); + openUri(request); + } } - catch ( UnsupportedEncodingException e ) { + catch ( IOException e ) { Notifications.Bus.notify(new Notification("Dash Plugin Error", "Dash Plugin Error", e.getMessage(), NotificationType.ERROR)); return; } From c99f88e4f2837e2d95e0dcc5ec37d1dd857c37a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Wed, 12 Nov 2014 04:06:29 +0100 Subject: [PATCH 58/97] os dependent menu name --- META-INF/plugin.xml | 2 +- src/de/dreamlab/dash/DashLauncherAction.java | 41 +++++++++++++++++--- src/de/dreamlab/dash/SystemUtil.java | 35 +++++++++++++++++ 3 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 src/de/dreamlab/dash/SystemUtil.java diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 4135f8a..93a9816 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -69,7 +69,7 @@ - + diff --git a/src/de/dreamlab/dash/DashLauncherAction.java b/src/de/dreamlab/dash/DashLauncherAction.java index 6478b97..1718f5b 100644 --- a/src/de/dreamlab/dash/DashLauncherAction.java +++ b/src/de/dreamlab/dash/DashLauncherAction.java @@ -6,10 +6,7 @@ import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; import com.intellij.notification.Notifications; -import com.intellij.openapi.actionSystem.AnAction; -import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.LangDataKeys; -import com.intellij.openapi.actionSystem.PlatformDataKeys; +import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.SelectionModel; import com.intellij.openapi.project.Project; @@ -19,13 +16,13 @@ import com.intellij.psi.PsiComment; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; -import de.dreamlab.dash.keywords.AbstractSdkKeyword; public class DashLauncherAction extends AnAction { private static final String XML_LANGUAGE_ID = "XML"; private KeywordLookup keywordLookup; private DashLauncher dashLauncher; + private boolean isPresentationInitialized = false; public DashLauncherAction() { @@ -33,9 +30,41 @@ public DashLauncherAction() dashLauncher = new DashLauncher(); } + private void initPresentation() + { + String docAppName; + + if ( SystemUtil.isIsOSWindows() ) { + docAppName = "Velocity"; + } + else if ( SystemUtil.isIsOSLinux() ) { + docAppName = "Zeal"; + } + else { + docAppName = "Dash"; + } + + Presentation presentation = this.getTemplatePresentation(); + presentation.setText("Search in " + docAppName); + presentation.setDescription("Searches word under caret or selected text in " + docAppName); + } + @Override public void update(AnActionEvent e) { - e.getPresentation().setEnabled(PlatformDataKeys.EDITOR.getData(e.getDataContext()) != null); + super.update(e); + + Presentation presentation = e.getPresentation(); + + if ( !isPresentationInitialized ) { + isPresentationInitialized = true; + initPresentation(); + + Presentation templatePresentation = getTemplatePresentation(); + presentation.setText(templatePresentation.getText()); + presentation.setDescription(templatePresentation.getDescription()); + } + + presentation.setEnabled(PlatformDataKeys.EDITOR.getData(e.getDataContext()) != null); } public void actionPerformed(AnActionEvent e) { diff --git a/src/de/dreamlab/dash/SystemUtil.java b/src/de/dreamlab/dash/SystemUtil.java new file mode 100644 index 0000000..7214e7b --- /dev/null +++ b/src/de/dreamlab/dash/SystemUtil.java @@ -0,0 +1,35 @@ +package de.dreamlab.dash; + +public class SystemUtil { + private static boolean isOSMac = false; + private static boolean isOSWindows = false; + private static boolean isOSLinux = false; + + static { + try { + String osName = System.getProperty("os.name").toLowerCase(); + + if ( osName.startsWith("mac") ) { + isOSMac = true; + } else if ( osName.startsWith("windows") ) { + isOSWindows = true; + } else if ( osName.startsWith("linux") ) { + isOSLinux = true; + } + } + catch ( Throwable e ) { + } + } + + public static boolean isIsOSMac() { + return isOSMac; + } + + public static boolean isIsOSWindows() { + return isOSWindows; + } + + public static boolean isIsOSLinux() { + return isOSLinux; + } +} From 300bda280cd4f14da50f42fd72a3c3a67e26c693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Wed, 3 Dec 2014 18:05:34 +0100 Subject: [PATCH 59/97] added icons --- Dash.iml | 1 + resources/dash.png | Bin 0 -> 573 bytes resources/dash@2x.png | Bin 0 -> 1025 bytes resources/velocity.png | Bin 0 -> 1459 bytes resources/velocity@2x.png | Bin 0 -> 1822 bytes resources/velocity@2x_dark.png | Bin 0 -> 1846 bytes resources/velocity_dark.png | Bin 0 -> 1470 bytes resources/zeal.png | Bin 0 -> 1700 bytes resources/zeal@2x.png | Bin 0 -> 3403 bytes src/de/dreamlab/dash/DashLauncherAction.java | 7 +++++++ 10 files changed, 8 insertions(+) create mode 100644 resources/dash.png create mode 100644 resources/dash@2x.png create mode 100644 resources/velocity.png create mode 100644 resources/velocity@2x.png create mode 100644 resources/velocity@2x_dark.png create mode 100644 resources/velocity_dark.png create mode 100644 resources/zeal.png create mode 100644 resources/zeal@2x.png diff --git a/Dash.iml b/Dash.iml index 4db095a..0e6f704 100644 --- a/Dash.iml +++ b/Dash.iml @@ -5,6 +5,7 @@ + diff --git a/resources/dash.png b/resources/dash.png new file mode 100644 index 0000000000000000000000000000000000000000..6d3fb277b52a95220177f434ae4a08e2ba9607a1 GIT binary patch literal 573 zcmV-D0>b@?P)Y6sM%phQf~)~OPL0fkm#sFHx9wn9L_cI?D{ z&#&)8n9u||z?Gh#@AW3>=*obN< zB$7ZPr6E4p8{BpP`-Z_b0m6`7+k0J%iVxS+&!>_a`bKql-1qzkj*o%o06qzDW3oJt zD1rtJGO0lgi|=MIGBMDF^IeLg-8!oKSJICp7#a;GOV!2Wk`e?_imx9l@EqEG@IVCf zt5Zn78iwT)_&SvsVNyYpQrJGPt!iO=vkdF99fGIlMzF9vf$_;9%)fns?}ryqm;j-I z7NMM3tzUl}Y`kBPOZer33zW92GC7%!Lr+CzTwp>4E)`(bC0!&6yE5+-)qgusnBa~; zu-QEbY)+6K>&MFajP#u*kuinoB;Xffd3qPY*3QyB|I6MP&r_Gz>Qvxzf`%JGEY|z? zS1KmL(%blLA6!9GPSAYQkX`Sh1ko%Y500000 LNkvXXu0mjf=>Y`8 literal 0 HcmV?d00001 diff --git a/resources/dash@2x.png b/resources/dash@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..70750bd8081d5965a43045f69021565dde02ca33 GIT binary patch literal 1025 zcmV+c1pfPpP)71g(m?Xdt#KSZjUNK5QG4 zW|B;DuO~x|naqsM*tpUIm(1keob#RUeD~&D;9obvZX$fRr;R?^X(%&{5up)kx!KfN z7J%z5FBK6&2hAweb%3`95G4V!&so$=5@0!wR05cc(H9&M1|Dn;uZ!3MxN;~;!SO)$ z3jV-iz~vSyLUUH*82wD3Qhb5|dyd^&UjX4MUYO#n!{ZVBehSVANrp10h>@?n&%uw} zpHA}*`li{$!1)8+Z30ohe5C+)g)%QSjhGnd=Tr?IJbtIS)4)KA@%Fk|RH~xP1FLJM zbsGDmLQ`{PGa=V-#J=;qxQzf*&Xj;pM27vMy|HBxQCHuimst8t6){lI zfX4ImTRVGr^}Rj}0emh5mikaz@4@1=wP@Tq*IbT`v&mPympfLRa=lm(Y-S z71N)iUBh@B{)B_a*I?eV>cSe2PeR?2DvW$c8V@Eb2C{hu*zbd$>fB*?KhyT4@ceB= zMOXMEj+|&P?mVxg*WLiYj)Anpldp7rf><#f!xX%9oizh&dIn5oD9Ox4*_K+IK$#d| zHVkME87N)9ao2pqyE>W0hj$4JR%|qocE~`wD3fiw7ocf#y=xU(OXqqq_%&(WA6PSBe-Jsfi=iGoy8p$# zL9r9zB#B@qy+Cht43{sy!N9w?y>2qxt^_%#ng}kH4`7m1-rx5f&z=tB#nT}S53AD) zH_L5B7>TP)5#6Hgj}Pp>H{iR~DV$5ppCpMr>0;$fR}EN616)?W?1avaV(;8m_ld v``k`F^vteiLO!q%djGn$6aUS^eh4rC{+taR+?^)m00000NkvXXu0mjfhoR(Z literal 0 HcmV?d00001 diff --git a/resources/velocity.png b/resources/velocity.png new file mode 100644 index 0000000000000000000000000000000000000000..eda7c3ee808f63bdd4a5b934e2f312fe99a2940f GIT binary patch literal 1459 zcmaJ>eN5D57%v}(297x6hPXND3S%1RwY{%i8&2-H)$NYoXw0-+N z@AL6{e$Vr?v%G9ydg}A32!f=$OPm#OeJ1v7PJ!>N`DG3+JJjN8wNmz}VNL;v-7E6| zbqBawPysk^bHgYoK#-&kv8r0F_LQ=M9MEww9bF_4gw_aBP#6hvLLE?19@L7G75n2# zABKuvEB3m{LwbS^;1^3;6j0exRwcC535*vj+=~`OSm+=CR1S><>ZK4Hv0^KJS@<0j z6BxRpqSjflRZ!KQa?~L!05$2%xIj`ylxB34$xJhJKB|X%g0v8N5+@nfWMD}>x^`hO zn&S1b6;9V$EV#2`epL;!1Q8C0bzy@}R%!`~VHkqc6M8)kHSkcgq;e5l3T4MVI6+8I z#Goq55*qW!@p7YT#URqv6aqnyXWg+BS|bWlMnt$ELFq^$5Qycqq8(Bz!2d8d)DBfO z2LVw5LUN-bzYcLC7yy#$c3LrbqVtMg)@-DBlHq;0 zg*O^;BX0mW4`>>4Ya)S<6Bx=z#{Fz$@3I?;j24H5Ht1axRcy4=7IRUtp0QB0!$C6o zxUE|XshlK$cx(~IUbCg2YRftlz^SrQCCl~kE-3fQsvPpmLDb<`sXDsb!wI4k6Yhx> zYBg^sP{bzSbt!THU16FPH$Y*gX^v(LBo0glGj0To59chL9v2vahBt5Vawcre-uncD ztDOoZFq2>$5DQ2%O#zD$=Xu72Qxv3)PH4^pvUTb%y)Bj3K1 zeB}K03FJ(!2G#s9GB&EK`Rr^znmhE*)St)0C-*;k@zK}cyz{%``qlZ)k(3@(JikfI z*fs;^nr;i^-AZq7%i|q`vzokTb1rmu%Zt;R(t|U4iix%)px62npZjUc#RD(Ba<9v7 zcOBtwoi=E{`04>UV(q89Ji zz4UO3teKwGT+#mgawh6WN~sYv>QjH*YD9dS(}*qYuZjudc?YFQY!Zofgon%e2WQ5X z+IRouygW7W>%%#lqiOGCwXJu`ko55}a`62Dg?wQT-fC;Qp3vH{*fO8-o18P2);7L% zLi4U|Co+`!R^PS9?RU0a>PepIM8^(%xyy>2b(X*3y7hhkiNrevS)YU66oZ<$)*hEA@ho0ipc~e()H^)PC%tM%h%2E*LAD+2Oe!uTG-_Q5^`Myfy zW0y>w^6?ZNk2f_cQklS=faB%6a$jqH{xj~F!>Ur)M8?485*Csdu4l9)5JeH`WCBU( z^S)>&LwLN2>y4TeHbosH(=n8QaM%cJl$k^Gcp+gnGodq)ETARRjkFx>`>7cOjCwhk zEK!TpW(ApHjLf%?iTSY_UA{?&>%p*4AjBr)98e@n05&R%w#saBaMZ7iyF1iE5EwOK zO>%IIREjztP%st}kO+byod`w&DK3B|!BSkh5D;^+P=pD^B1nYGB#2BT2Hrd%7tNwK z$P$!`-^Ai1Ihet+W|>f!o0}`hMFfl`T?peiE)KkEjq3r2Jdk&SGx}fau{-KWN{WF*Aya4$>_2vl4hfna*+EY&>QtKL@PGH zgam^y34%kY2-ZS4ieV5UK@lB}NpM(1jQe>XesMSwfno}U6cI0mVHFxK#eySLVjP2| z3WW$4k7J`~D@)Kiay+(?i~R;0@jb!W-w+zp&0Et;IAfh zM%tkaa5QQxZzX9l=8*cu7KQ>wD=jm=hlO5*!cuK80vQNW1fdwJg)pfUflvg+5sbtz zlHjr!!|UIv;Mk;c8ZHy_I3XE{!3c(6Vo0mSB@hftr4WHjf*}kSkpwD5wHPS@g&akp zV|d;frg0TFp^od@)!>A;%SF=MMp?Mk@k!&yaT_U!Qif}6caA07KT9M$)@+FkI?=Y# zYri%~y!lX4(MM}(d$GHsDD<>{%ckxF;m-CQs*%D?f*-rjEngV8F7)SpRjge(M?Bj* z*!y6rx?gu(6<9qGa( z!&eFROaa@Fe0c=97k!Pt!1r8(hoFs`ba;AsU=(G08r>@1S$$zzSbE|=U40WqQfEx= zj*e^Wn-yJN*pRw@c;!UT+$ZiX(|yxd`yK4Me#Ufi4-J#ES6#tdwC&?9=PJwTTJ@pEF?=$3kN;8#uXh2a&2PCQVw&dnJ2lG_{}FG>}wtczH=?mvSEzc~N^ literal 0 HcmV?d00001 diff --git a/resources/velocity@2x_dark.png b/resources/velocity@2x_dark.png new file mode 100644 index 0000000000000000000000000000000000000000..a70f6d03ebec3513cb4c5c8455097ba899599738 GIT binary patch literal 1846 zcmaJ?X;c$e6pj+BazqHOD9RWR0Zk@5nMhc&u+*RsA|PrZ%Roj*CL{xdh%5>guxcq4 zcSQ>d9)%-_qIDs~wH8s7vJ_>hXsK3I^eC>KfY|;}=bV}M?tAyU_q*GfypY8KHr6w& z2?T;oP@qVPuYlzp_Z9v%m`u;`#Q_sXVqs`3mLk`~1V0t3fPo;5JPww^a#d>L71)bF zu+ky2NGvi~!c(Fes@$SOHEMJ?nn3XKG3w;Xco+i|a2%rLlly-@M+OiTpB%vsrUmPS zuo?+8>ESTbVwutuuY^=&A8)|R$ioe2U`!4eH3?b+&&Vea+2!GT%P~j>hE%Y4K6#i_ zWN-)|MD;MhrgA7s8l44rLR31N;|X~#02sIo(zqalMxjAGHj_tV03RMQ?oF?X(g zEnu-ISD;B4pNumd4nd;}4*qCZYxs~TJY}F!t^?^*8mQ4&;u_L6U{d%$8lTiQ$WnDM zD1{AZl3t0|Bi4BYjOXsljx35e8{QHd!lgaR>)5R=5PcBCwW%MgeDiLUtUtq2nN$&BsCB9=&Q#!Swz8|^0CP%viPFEYE0 z{$kVP7~-=obGB~4b}YL)=5(MyBJq;g-s!%WRZlY)Pun=&bfe2E+2o-`ggiSN8Ol zJB=}&N5V4CZ)6-*7|hrH34AE%v2HCYJo4Kt>tNq=;Q5W#(H*bHcAED@&$+xT+_76y zO2}KTQe3#V2F|H-N)8HTE-3D`%A)_}G(D?1)9F{M{_c)jjnB8%g%nGV*k^Q&?LgwJE^{*^{IU+ zX+56b_4clDT6O03+=(x5J+If;WtNrtoK&Or+m%72tDJh#ld>sR_tdHeE007ARlAnxj#2g`{E%HMKwdb#Lu zO~xY4r?7WBJ z$W5``4%Bx6S8*+iNIgi*Zz`)7)P{JuX+-m=g^L&D_kwcGclg*_pqp6aO<*Li4T)#`qHc9!NBx{gk)$BpIq}Sn zj>lJWbr}()X%26^luh@jj+#J^10Apff7hKnN&b=eidvi2j+~O&VY`(o`?Ehzq%>ER ku62#7X_#FNy_#1?_*Rv3z_`B1!}2E!5-%222x8X$3y~wql>h($ literal 0 HcmV?d00001 diff --git a/resources/velocity_dark.png b/resources/velocity_dark.png new file mode 100644 index 0000000000000000000000000000000000000000..56a075210ba2b699d07b1656a9f2435b863492dc GIT binary patch literal 1470 zcmaJ>ZA=qq96w&lKw+{Ok>a9fF@zb~dugG)OK+vNAYE+50vqvz>D~1yT%dR7^`NC= zgUGUoSwvZ~B{DaR@@30drwi&}y5Y;}2F{m6Gcui3HYjw+e!wEJuait*qJcH$6@HZkn2>l|?O=)yh?ZPY%)&fUI7D0kFeQ z*8w-6y)ApM05b%oh+K88TJ5i@-1NB@*SOQgHS2Y`MU>J||o zZV(WfBvz@1FF!$6a`$XQaiHQ2xl`hlqR@?Yfo<{wUUt|ijdG*&a$d5;fH5e+__QX* zV9**EJbRCjfpO(tQTY87D@U-%^{$Y;C9dgzxrpKn5^t0Lv`ykj z>BabVc?c9?d5i$B%#NfCiT;>Z8L^~?4!gBFG{(%#&s#b=J2O(qYXO%7a!;4e#BSUr z4x*1XS>8f_KC?GvWNvDFP0H#c1u9r|EBfu#g5Kj>ufWkCXG?c}y*YN}`g?PEw_R@* z4hG3b6Th4nsiKO!KdeVo(`R!V->p%9S<|QflM0WD{>KHXft%aMH&}+UZcWb3KD`JS z34WYh+M4v+zS+_Z>xL<3?v_icT-VW|%aOijb;rF+RhcI(=kWceF|2UM1oK3iD!K4} z%j$`?uUc!8KIwYF*FN0!@%h{w-gFtBeWdER+h3D;V5T(_&p7NE-E{Rs_ROK~OOp?N z3Pg5$g;TxHeKhvz)6BMW$^NEhsKK;$<9CzeQ*~#C_8+G@%B!@M=A6MKbdtIGnyJV3 z>WlT!^${z6J?7~+)=zsF7}_#3q%IoxtgbRzL3?7qf@~B^ej_6-JrAnN#M4ix?=+=m zwX27Rf4I==-VOcz{Rcg#_Zy)Tu{&R^os5J|&BF)GyL6#}FlD}W=xCQQCtLSqR;-UtDnE8e|Wp+w5Khf+XG!Z7}cex-iIo;K6o;9bAC-qN76tf^?oNj zy6f|e6qI4#cLNVM^Xt0NP}}tHt!Zy>USFEW?y>A?k5QiHv~(20&PKayuB%+}KdPh5 KW$)kS+4m3d(+(a0 literal 0 HcmV?d00001 diff --git a/resources/zeal.png b/resources/zeal.png new file mode 100644 index 0000000000000000000000000000000000000000..4cd2b3f0dd52bbc591b933380dd7d9b60b1dc695 GIT binary patch literal 1700 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+m^Cs(B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxOgGuU&_u!9QqR!T z%-qskN5Kfl*Eg`xH!{#Qu(UEYwlXkMfC43;ZAB?*RzWUqP`iLUTcwPWk^(Dz{qpj1 zy>er{{GxPyLrY6beFGzXBO_g)3fZE`@j@w*YQzUNJP7fB~jokyxN_sAmB35=^15FMg%Dxp39RB|)hO_hL1;IHa;5 zRX-@TIKQ+g85nVC${?!>telHd6HD@oLh|!-V4)b0kzbNuoRMFk;OqX$Y%oHnE6GumLBV!YDV#4B|o_|H#M&WrZ)wl*A%B-P=d%U0NU)5T9jFqn&MWJpQ`}&xK$=@w;16x z52`l>w_A*H>eUB2MjsTtNYM=w0;VAl6P|d19C-3i%>$J73mS|3nBq-f(J$hF{s;)Es*2d77xOFT3)n0SRA z$uC&o7|^H@Fr}@HE0E3A#9@L{l4DnPcY)~fvURodf6uu4aLwZ#kJg-f^XA2yneVOd zFTYp&`D^Ri!cVCixBh$M-miC|i)Zng1w7AXT9fU$ewuNGOmyB_m-ubr@$)nMmVZ8+ zUmsWb=EftY-m@)|Nj1w)PLi0dB691&7B%^I4CVKP zOtaID6nd$tKK49y?5cN&zs*_O_w`=0o-O&yxO3|y)4=@$oa-c8P?Ophd zKVO+XDm?vXEH5k@llFA-_KmBxO~m;ori;Dh;z}-lT*-Cb_(?U#CY{93>$8hqbMoyk zo%Ydw^`E~tBW-41m=mue-@ha-cuHhMddjxl?3P`H^&U?SKYGcZX=y4gQjbh*Nnr=T(#__dRO{R{ImPiQ~rAgX6IepQ7vaWbAgS#en-Hm z^op2 zzS)ODr}hh-=UTNXP%`WMtxXe-CR;t^`PXZj`s!?ET=mn?c{Q(8%vK4X+Om2o*D>>q zjUV(H_Abqtu=LTDw{o}lD&E|wza`SHXv@b#-RBKEgqc3NYo*n@i~g{m^Q^yZ0wzg+oh zx?WtMx3~B4>%ShazaN>Szdxj%w_E$={j|UK3%8zXs}0@1b)S)v&ENS9%naWGYh0_= Rs(OR!4Nq4;mvv4FO#tJ|r*QxP literal 0 HcmV?d00001 diff --git a/resources/zeal@2x.png b/resources/zeal@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..6428d44e917222c320fcc706ac49dde13435198e GIT binary patch literal 3403 zcmaJ^c{r4N{}yqEM6#77V;rF{o575o8DnW8928=ViNP#pM)q`u$jMqUwAf9q5=Dh% z%`Oa5S&FhHNzrL+@s8fpd4GSL^LwuAdA{Gz=eqCvv;OlWIUdLE6;lus5D?gFYlC*; zpTM0LAj1DLA|t=@kAqB%JJXqZh8c#Z69p{%sJ=v?EgA1mbRy#YB0{=|#sUIDnj{x@ zraSH!ia;gn;&(8*;ba=0Eg)cQ7EZ$xf{09@FVUYwF##>rHG+U7KNFA}0tdm-tcU?5 zn@Bp*Ir6v*Au@=7^aGih0*%8_d;v0%i3f(0gDDJDxC!WoE{cEOaf3m?9}s4c3FyB` zx#JvxR#Z9>h|ty7AwZydKm(*M6rpc`G|&dZ_%;|~2!=s)AV?Gfj)K5|e?1_6G`imz zloQ(euULG`1Qftz(okSrfbKKNZkK z27ykZF-cSka7PjEOATe3fcTmIw*)fnZ&?cCuQu@;1`fy5z))StPDww3INbjaC6oU~ zGnh`q|Kf*@f(xo9dOluV>Be{%i)$A$hYcV{8UG=5|>kxn{G^s}Z@$-p0lqe%ad z3j~UUK`pJV|5fiVuHQf8@`Gyy`S&`&{A9p8ecHuRoE(-+4NJ zxw8RYrv(H=Yi-dMF5#nB-N?zFMA>t1HV|Q-o_*~2c(!hl;t^2&;DKhZb@6%Dd6nkY zN9{IkK9K#6?fYPG&?&3Z>v7%9 zdZQ{hZy_e8FUo(HJwOb7X+Ou;*5Cbh(cB@=17`&^_P3fVwk6p1F|#LUWkwcz8~1@9s{ zQ!G!(e9ruRq2~R7P3|0^?e;SHX}&JtAaZ_<<$mP{zvRZ^xVtQ@i`{#zn% zSu<|osHVaYGkNyyAasP2oZuma^^8BQ92;33C+}^z{M2Y^IghdM@cm~y4c8*IqI8Eu zM{>{$npFxH-hH+JP-5NgpA>Qc(U@e{9VdNle(*7x&DFB_b)cJbWcacmXgBJZ9_(a) z=uzaohvhU>UxtS5Q=_QaUM92GU7fJ|kf$}^K`r!XwhtwL1t_9_1gCaQRs9l!8~ud0@fKvSx7k>~qzVn;u4Px<)C zq~-&YIMS^~_Lo_hmi_ZzX>VJQg{AK=Cho!vLWGg^GT7D{4zJWjbX)Mvx#c-OL&>}7 zV{vKUJm96}-j^J<)&cmuCVO72gndV9enW^5t6e~^$GKAraDcFly*%4VC*Sy04d?QQ zwMnZvE*)TgF5SFV2I=hhN>64p>vB((c%aX2i4)xJwn0Vsf$bL4@h>gHoaz0kpI)ch zYor24BlpT=40}@Fm%Tk_sF2+!>y@3#rqymrMjlZ#Wlagi&BFP4uU=8ja###wjX>apj6*(64Iss;^U zwa7l-`is4G^;N|?n{{$&B|w{aR_NgsMGDc-Pd|DMfg>W%Q8L|nq$JtI_xIfSnV-a&- z!J_hmwiKb$Gw$LbxpeH1qve%3t(U_3(n5z5u~NXj89W%L$!A${qUD>4G3$x)6xaXc zR7bzh=f@V|!wM_8gZHi`&sTX)`geD3ZNAfP|1_HRv1QC=!c@4;Za?MM!gR;nTV1V9 zmmm!k>8w-G$a>wVU6>1iwavTkfko9ZqS70Uy@8#y<)l0aKwhzN{h(iueW#{r#5gOX zk3$w&oGEq{gsk;0HTi2jN<9=WkI-hUcc_Xp&L&MGz@w zuaVm^Ugc0QIT|qJD!#aCsP-EGbCs2z!g(SyR<2nHoP7DAlswKVt77F~RUUAA)W`FY zXKnHN$aMRvt}Ln6gCG7>xb_smoGj9anMmxtTdI6ea9_r^iS0n7YD8!eidAr!HG81t zi>-@w`(#=&TjI;fg<&?7SEmu6S=}!__LzoaVqmk6bEmq*9WO;ce}5mHxq|mH6j0qa z5*Y6u?EFLtd-Es(iidBY8Z%iI%eBp*Bd zW@cqqZdB#)g+}sGR$Ixlg-e;QHEU%#-e@6tWQ1Olf0^<^jc^gQXWodg{#bSXo|kjB zQ{c&wC+k6rM?_ig&ZZXQ9xYkM)TZPxmIC|pl`4KEJ#62nFxp|$LJv;$g^CY=4#osp zHc?&_q31jmPnnd!2G!X8M{)_b4oOvrtt@ms(WJ=E9J6^8Vs}I;#67Nv!3d9hl$e6| zGoGiUtOK15<8x}&ne+C}9Wwb!D>uT6503PT#e|R8>9qIVPAJ;=eUlTDZ1>zxC-{#= zlez-KwZYLKNYv9ap0UgQGL?Y}4rdUkH^qkU~5$?2`q6?f;##LRei39uof?aV(Ut(v|{*+iVR zOJYyJZcIz?=t0Hj3sT-0;2)Rwi9;O^-Q-F2NqRZg#+sQ-9= z#Y~Ay^vG)dt=(|e$WM_Xo;tZXZ!i$GZm{YSCKp1SEE}zl;yu0Pkhk?IOUL Date: Wed, 3 Dec 2014 23:16:29 +0100 Subject: [PATCH 60/97] finalized zeal support --- src/de/dreamlab/dash/DashLauncher.java | 91 ------------------- src/de/dreamlab/dash/DashLauncherAction.java | 8 +- .../dash/launcher/AbstractLauncher.java | 43 +++++++++ .../dash/launcher/DashSchemeLauncher.java | 55 +++++++++++ .../dreamlab/dash/launcher/ZealLauncher.java | 41 +++++++++ 5 files changed, 144 insertions(+), 94 deletions(-) delete mode 100644 src/de/dreamlab/dash/DashLauncher.java create mode 100644 src/de/dreamlab/dash/launcher/AbstractLauncher.java create mode 100644 src/de/dreamlab/dash/launcher/DashSchemeLauncher.java create mode 100644 src/de/dreamlab/dash/launcher/ZealLauncher.java diff --git a/src/de/dreamlab/dash/DashLauncher.java b/src/de/dreamlab/dash/DashLauncher.java deleted file mode 100644 index 0ec1af8..0000000 --- a/src/de/dreamlab/dash/DashLauncher.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Created by gerard on 04.04.14. - */ - -package de.dreamlab.dash; - -import com.intellij.notification.Notification; -import com.intellij.notification.NotificationType; -import com.intellij.notification.Notifications; - -import java.awt.Desktop; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URLEncoder; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; - -public class DashLauncher { - - public DashLauncher() { - } - - public void search(Collection keywords, String query) - { - try { - if ( System.getProperty("os.name").equals("Linux") ) { - List command = Arrays.asList("zeal", "--query"); - StringBuilder queryString = new StringBuilder(); - if (keywords.size() > 0) { - // Zeal only supports searches with one keyword. Until that - // limitation is fixed, we can only search for the first keyword. - String keyword = keywords.iterator().next(); - queryString.append(keyword); - queryString.append(":"); - } - queryString.append(query); - ProcessBuilder pb = new ProcessBuilder("zeal", "--query", queryString.toString()); - pb.start(); - } else { - String request = "dash-plugin://"; - - // keywords - if (keywords.size() > 0) { - request += "keys="; - int i = 0; - - for (String keyword : keywords) { - if (i > 0) { - request += ','; - } - - request += urlEncode(keyword); - - i++; - } - - request += "&"; - } - - // query - request += "query=" + urlEncode(query); - - openUri(request); - } - } - catch ( IOException e ) { - Notifications.Bus.notify(new Notification("Dash Plugin Error", "Dash Plugin Error", e.getMessage(), NotificationType.ERROR)); - return; - } - } - - private void openUri(String uriStr) - { - try { - Desktop desktop = Desktop.getDesktop(); - URI uri = new URI(uriStr); - desktop.browse(uri); - } - catch (Throwable e) { - Notifications.Bus.notify(new Notification("Dash Plugin Error", "Dash Plugin Error", e.getMessage(), NotificationType.ERROR)); - } - } - - private String urlEncode(String s) throws UnsupportedEncodingException - { - return URLEncoder.encode(s, "UTF-8").replace("+", "%20"); - } -} \ No newline at end of file diff --git a/src/de/dreamlab/dash/DashLauncherAction.java b/src/de/dreamlab/dash/DashLauncherAction.java index 543aa56..60772db 100644 --- a/src/de/dreamlab/dash/DashLauncherAction.java +++ b/src/de/dreamlab/dash/DashLauncherAction.java @@ -17,6 +17,7 @@ import com.intellij.psi.PsiComment; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; +import de.dreamlab.dash.launcher.AbstractLauncher; import javax.swing.*; @@ -24,13 +25,14 @@ public class DashLauncherAction extends AnAction { private static final String XML_LANGUAGE_ID = "XML"; private KeywordLookup keywordLookup; - private DashLauncher dashLauncher; + private AbstractLauncher launcher; private boolean isPresentationInitialized = false; public DashLauncherAction() { keywordLookup = new KeywordLookup(); - dashLauncher = new DashLauncher(); + + launcher = AbstractLauncher.createInstance(); } private void initPresentation() @@ -141,7 +143,7 @@ public void actionPerformed(AnActionEvent e) { } // open dash - dashLauncher.search(keywordLookup.findKeywords(new LookupInfoDictionary(language, psiElement, project, psiFile, virtualFile)), query); + launcher.search(keywordLookup.findKeywords(new LookupInfoDictionary(language, psiElement, project, psiFile, virtualFile)), query); /* use the following command to display information about the sdk in use in the event log. intended for development purposes. diff --git a/src/de/dreamlab/dash/launcher/AbstractLauncher.java b/src/de/dreamlab/dash/launcher/AbstractLauncher.java new file mode 100644 index 0000000..dc79017 --- /dev/null +++ b/src/de/dreamlab/dash/launcher/AbstractLauncher.java @@ -0,0 +1,43 @@ +package de.dreamlab.dash.launcher; + +import de.dreamlab.dash.SystemUtil; + +import java.util.List; + +public abstract class AbstractLauncher { + + public static AbstractLauncher createInstance() + { + if ( SystemUtil.isIsOSLinux() ) { + return new ZealLauncher(); + } + else { + return new DashSchemeLauncher(); + } + } + + public abstract void search(List keywords, String query); + + protected String keywordString(final List keywords) throws Exception + { + if ( keywords.size() > 0 ) { + String result = ""; + boolean first = true; + + for (String keyword : keywords) { + if ( !first ) { + result += ','; + } + + result += keyword; + + first = false; + } + + return result; + } + else { + throw new Exception("empty keyword list"); + } + } +} diff --git a/src/de/dreamlab/dash/launcher/DashSchemeLauncher.java b/src/de/dreamlab/dash/launcher/DashSchemeLauncher.java new file mode 100644 index 0000000..a78d6c9 --- /dev/null +++ b/src/de/dreamlab/dash/launcher/DashSchemeLauncher.java @@ -0,0 +1,55 @@ +/** + * Created by gerard on 04.04.14. + */ + +package de.dreamlab.dash.launcher; + +import com.intellij.notification.Notification; +import com.intellij.notification.NotificationType; +import com.intellij.notification.Notifications; + +import java.awt.Desktop; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URLEncoder; +import java.util.List; + +public class DashSchemeLauncher extends AbstractLauncher { + + public DashSchemeLauncher() { + } + + public void search(List keywords, String query) + { + try { + String request = "dash-plugin://"; + + // keywords + if ( keywords.size() > 0 ) { + request += "keys=" + urlEncode(keywordString(keywords)) + "&"; + } + + // query + request += "query=" + urlEncode(query); + + openUri(request); + } + catch ( Throwable e ) { + Notifications.Bus.notify(new Notification("Dash Plugin Error", "Dash Plugin Error", e.getMessage(), NotificationType.ERROR)); + } + } + + private void openUri(String uriStr) throws URISyntaxException, IOException + { + Desktop desktop = Desktop.getDesktop(); + URI uri = new URI(uriStr); + desktop.browse(uri); + } + + private String urlEncode(String s) throws UnsupportedEncodingException + { + return URLEncoder.encode(s, "UTF-8").replace("+", "%20"); + } +} \ No newline at end of file diff --git a/src/de/dreamlab/dash/launcher/ZealLauncher.java b/src/de/dreamlab/dash/launcher/ZealLauncher.java new file mode 100644 index 0000000..da79cc9 --- /dev/null +++ b/src/de/dreamlab/dash/launcher/ZealLauncher.java @@ -0,0 +1,41 @@ +package de.dreamlab.dash.launcher; + +import com.intellij.execution.ExecutionException; +import com.intellij.execution.configurations.GeneralCommandLine; +import com.intellij.notification.Notification; +import com.intellij.notification.NotificationType; +import com.intellij.notification.Notifications; + +import java.util.List; + +public class ZealLauncher extends AbstractLauncher { + + public void search(List keywords, String query) + { + try { + String queryStr = ""; + + // keywords + if ( keywords.size() > 0 ) { + queryStr += keywordString(keywords) + ":"; + } + + // query + queryStr += query; + + openCmd(queryStr); + } + catch ( Throwable e ) { + Notifications.Bus.notify(new Notification("Dash Plugin Error", "Dash Plugin Error", e.getMessage(), NotificationType.ERROR)); + } + } + + private void openCmd(final String queryStr) throws ExecutionException + { + final GeneralCommandLine commandLine = new GeneralCommandLine("zeal"); + commandLine.addParameter("--query"); + commandLine.addParameter(queryStr); + commandLine.createProcess(); + } + +} From f7e204243ffa6964a2aac88330ad21b7be521038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Thu, 4 Dec 2014 01:29:57 +0100 Subject: [PATCH 61/97] updated version & readme --- META-INF/plugin.xml | 35 ++++++++++++++++++++++------------- README.md | 39 +++++++++++++++++++++++++-------------- 2 files changed, 47 insertions(+), 27 deletions(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 93a9816..1cf5c94 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,31 +1,40 @@ com.paperetto.dash Dash - 3.1 + 3.2 Gerard Delmàs A smart and simple plugin that provides keyboard shortcut access for Dash in IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm and Android Studio.

+

A smart and simple plugin that provides keyboard shortcut access for Dash, Velocity or Zeal in IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm and Android Studio.

 

Flattr this

-

Usage

-

The default shortcut assigned in the plugin is Cmd-Shift-D.

-

It either uses the caret position for the search, or the current selection. The plugin will identify the currently used programming language and request filtered search results accordingly.

+

Usage

+

The default shortcut assigned to search is Cmd-Shift-D (Mac OS X) or Ctrl-Shift-D (Windows, Linux).

+

A menubar command named either "Search in Dash" (Mac OS X), "Search in Velocity" (Windows) or "Search in Zeal" (Linux) can be found in the "Tools" menu.

+

The plugin either searches for the statement at caret position or the current selection. It will identify the programming language in use and request filtered results accordingly.

-

Kapeli Dash App

-

Dash is a Mac application for rapid search of developer documentation. There is a free, fully functional version with nags. It can be downloaded here.

+

Configuration

+

Shortcut

+

You can change the shortcut at Preferences -> Keymap -> Plug-ins -> Dash.

+

Toolbar Icon

+

You can add a "Search in Dash/Velocity/Zeal" button to the toolbar. Right-click the menubar -> Customize […]. You will find the button under "Plug-ins -> Dash".

-

What's new

-

In the past months I have been adding and testing new features for the plugin. I am now happy to release a lot of these additions that will make your search results just better.

-

From now on code in strings will be recognized. This way it is no longer necessary to select a specific word, the plugin will automatically know what you want to look up by the caret position. A lot of strings contain SQL code and for these your results will only be from a SQL docset. In Project Settings -> SQL Dialects you can set which SQL docset you want to search. There are docsets available for MySQL, PostgreSQL and SQLite.

-

If you have the "Regular Expressions" cheatsheet installed in Dash you can lookup groups, quantifiers and special characters really quickly. Just try and check what /\v/ stands for.

-

Android projects get results from the Android docs, not Java. Java results depend on the projects SDK setting, searching either Java 6, 7 or 8. The same goes for Python 2 or 3. Apart from that I added support for Bash, Go, Haskell, Lua, Markdown, Scala and TypoScript. Language support for JavaScript and others has been enhanced.

-

Simplicity is really important to me, that's why I always try to keep the plugin smart, simple and settings free. I hope this helps you spend less time searching the reference. Make the best of it.

+

Supported API Documentation Browsers

+

Kapeli Dash (Mac OS X)

+

Dash is an API Documentation Browser and Code Snippet Manager. Dash stores snippets of code and instantly searches offline documentation sets for 150+ APIs (for a full list, see below). You can even generate your own docsets or request docsets to be included. http://kapeli.com/dash

+

Velocity (Windows)

+

Velocity gives your Windows desktop offline access to over 150 API documentation sets (provided by Dash for OS X). https://velocity.silverlakesoftware.com

+

Zeal (Linux)

+

Zeal is a simple offline API documentation browser inspired by Dash (OS X app). http://zealdocs.org

]]>
+3.2 + - Toolbar icon support + - Velocity support on Windows + - Zeal support on Linux 3.1 - language detection support in strings - project settings sql dialect will be used diff --git a/README.md b/README.md index e72b20e..3b41c1c 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,40 @@ -A smart and simple plugin that provides keyboard shortcut access for Dash in IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm and Android Studio. +A smart and simple plugin that provides keyboard shortcut access for Dash, Velocity or Zeal in IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm and Android Studio. + +[![Flattr this](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/2558535/gdelmasIntelliJDashPlugin-on-GitHub) ## Installation -To install the plugin in your IDE go to Preferences -> Plugins -> Browse repositories and search for "Dash". +To install the plugin in your IDE go to **Preferences -> Plugins -> Browse repositories** and **search for "Dash"**. -[![Flattr this](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/2558535/gdelmasIntelliJDashPlugin-on-GitHub) +## Usage +The default **shortcut** assigned to search is **Cmd-Shift-D** (Mac OS X) or **Ctrl-Shift-D** (Windows, Linux). -## What's new -In the past months I have been adding and testing new features for the plugin. I am now happy to release a lot of these additions that will make your search results just better. -From now on code in strings will be recognized. This way it is no longer necessary to select a specific word, the plugin will automatically know what you want to look up by the caret position. A lot of strings contain SQL code and for these your results will only be from a SQL docset. In Project Settings -> SQL Dialects you can set which SQL docset you want to search. There are docsets available for MySQL, PostgreSQL and SQLite. +A **menubar command** named either "**Search in Dash**" (Mac OS X), "Search in Velocity" (Windows) or "Search in Zeal" (Linux) can be found in the "Tools" menu. -If you have the "Regular Expressions" cheatsheet installed in Dash you can lookup groups, quantifiers and special characters really quickly. Just try and check what /\v/ stands for. -Android projects get results from the Android docs, not Java. Java results depend on the projects SDK setting, searching either Java 6, 7 or 8. The same goes for Python 2 or 3. Apart from that I added support for Bash, Go, Haskell, Lua, Markdown, Scala and TypoScript. Language support for JavaScript and others has been enhanced. +The plugin either searches for the statement at caret position or the current selection. It will identify the programming language in use and request filtered results accordingly. -Simplicity is really important to me, that's why I always try to keep the plugin smart, simple and settings free. I hope this helps you spend less time searching the reference. Make the best of it. +## Configuration +### Shortcut +You can change the shortcut at Preferences -> Keymap -> Plug-ins -> Dash. -## Usage -The default shortcut assigned in the plugin is **Cmd-Shift-D**. -It either uses the caret position for the search, or the current selection. The plugin will identify the currently used programming language and request filtered search results accordingly. +### Toolbar Icon +You can add a "Search in Dash/Velocity/Zeal" button to the toolbar. Right-click the menubar -> Customize […]. You will find the button under "Plug-ins -> Dash". -## Kapeli Dash App -Dash is a Mac application for rapid search of developer documentation. There is a free, fully functional version with nags. It can be downloaded here: +## Supported API Documentation Browsers +### Kapeli Dash (Mac OS X) +Dash is an API Documentation Browser and Code Snippet Manager. Dash stores snippets of code and instantly searches offline documentation sets for 150+ APIs (for a full list, see below). You can even generate your own docsets or request docsets to be included. [http://kapeli.com/dash](http://kapeli.com/dash) +### Velocity (Windows) +Velocity gives your Windows desktop offline access to over 150 API documentation sets (provided by Dash for OS X). +[https://velocity.silverlakesoftware.com](https://velocity.silverlakesoftware.com) + +### Zeal (Linux) +Zeal is a simple offline API documentation browser inspired by Dash (OS X app). +[http://zealdocs.org](http://zealdocs.org) + + ## Troubleshooting ######The plugin does not work on old IDEs Older IDE versions like **AppCode 1.x** are not supported anymore. Please manually install version 2.2 of the plugin: https://github.com/gdelmas/IntelliJDashPlugin/releases/tag/2.2 From 963e43387659c73e202f104cb56210f8fd9e519d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Tue, 30 Dec 2014 01:14:35 +0100 Subject: [PATCH 62/97] fixed keywords not working with dash-plugin scheme fixes #35 --- src/de/dreamlab/dash/launcher/DashSchemeLauncher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/dreamlab/dash/launcher/DashSchemeLauncher.java b/src/de/dreamlab/dash/launcher/DashSchemeLauncher.java index a78d6c9..559255f 100644 --- a/src/de/dreamlab/dash/launcher/DashSchemeLauncher.java +++ b/src/de/dreamlab/dash/launcher/DashSchemeLauncher.java @@ -28,7 +28,7 @@ public void search(List keywords, String query) // keywords if ( keywords.size() > 0 ) { - request += "keys=" + urlEncode(keywordString(keywords)) + "&"; + request += "keys=" + keywordString(keywords) + "&"; } // query From 50f4312ccad32f0c65c57c25fd81e9ae01320a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Tue, 30 Dec 2014 01:17:17 +0100 Subject: [PATCH 63/97] updated version --- META-INF/plugin.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 1cf5c94..35d2fec 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,7 +1,7 @@ com.paperetto.dash Dash - 3.2 + 3.2.1 Gerard Delmàs +3.2.1 Fixed an issue where + context filters would not work 3.2 - Toolbar icon support - Velocity support on Windows From 3da11acff410e059198e4c3e7a01e81f66dfe58a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sat, 14 Feb 2015 02:15:38 +0100 Subject: [PATCH 64/97] actionscript support fixes #37 --- src/de/dreamlab/dash/KeywordLookup.java | 7 ++- .../dash/keywords/ExcludeFileTypeKeyword.java | 28 ++++++++++++ .../keywords/FileTypeSpecificKeyword.java | 43 +++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 src/de/dreamlab/dash/keywords/ExcludeFileTypeKeyword.java create mode 100644 src/de/dreamlab/dash/keywords/FileTypeSpecificKeyword.java diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index ceb440b..9e1c5b6 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -31,7 +31,12 @@ public KeywordLookup() setLanguage("Stylus", "stylus", "css"); // not PhpStorm setLanguage("HAML", "haml"); setLanguage("CoffeeScript", "coffee", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap"); // not IntelliJ - setLanguage("JavaScript", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap", "angularjs"); + + setLanguage("JavaScript", (Object[])FileTypeSpecificKeyword.createList( + new String[]{"javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap", "angularjs"}, + "ActionScript", new String[]{"actionscript"}) + ); + setLanguage("MySQL", "mysql"); // not WebStorm setLanguage("SQLite", "sqlite"); // not WebStorm diff --git a/src/de/dreamlab/dash/keywords/ExcludeFileTypeKeyword.java b/src/de/dreamlab/dash/keywords/ExcludeFileTypeKeyword.java new file mode 100644 index 0000000..89762e5 --- /dev/null +++ b/src/de/dreamlab/dash/keywords/ExcludeFileTypeKeyword.java @@ -0,0 +1,28 @@ +package de.dreamlab.dash.keywords; + +import de.dreamlab.dash.LookupInfoDictionary; + +public class ExcludeFileTypeKeyword implements IKeyword { + private String keyword; + private String fileType; + + + public ExcludeFileTypeKeyword(String keyword, String fileType) + { + this.keyword = keyword; + this.fileType = fileType; + } + + @Override + public String getName(LookupInfoDictionary dict) { + try { + if (fileType.equals(dict.getPsiFile().getFileType().getName())) { + return null; + } + } + catch ( Throwable e ) { + } + + return keyword; + } +} diff --git a/src/de/dreamlab/dash/keywords/FileTypeSpecificKeyword.java b/src/de/dreamlab/dash/keywords/FileTypeSpecificKeyword.java new file mode 100644 index 0000000..2c09bd1 --- /dev/null +++ b/src/de/dreamlab/dash/keywords/FileTypeSpecificKeyword.java @@ -0,0 +1,43 @@ +package de.dreamlab.dash.keywords; + +import de.dreamlab.dash.LookupInfoDictionary; + +import java.util.ArrayList; + +public class FileTypeSpecificKeyword implements IKeyword { + private String keyword; + private String fileType; + + + public FileTypeSpecificKeyword(String keyword, String fileType) { + this.keyword = keyword; + this.fileType = fileType; + } + + @Override + public String getName(LookupInfoDictionary dict) { + try { + if (fileType.equals(dict.getPsiFile().getFileType().getName())) { + return keyword; + } + } catch (Throwable e) { + } + + return null; + } + + public static IKeyword[] createList(String[] defaultKeywords, String fileType, String[] fileTypeSpecificKeywords) + { + ArrayList result = new ArrayList(); + + for ( String defaultKeyword : defaultKeywords ) { + result.add(new ExcludeFileTypeKeyword(defaultKeyword, fileType)); + } + + for ( String fileTypeSpecificKeyword : fileTypeSpecificKeywords ) { + result.add(new FileTypeSpecificKeyword(fileTypeSpecificKeyword, fileType)); + } + + return result.toArray(new IKeyword[result.size()]); + } +} From 4074d62eda9f0098d742e883293ac0d4c6f188dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sat, 14 Feb 2015 03:03:23 +0100 Subject: [PATCH 65/97] updated version --- META-INF/plugin.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 35d2fec..137d948 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,7 +1,7 @@ com.paperetto.dash Dash - 3.2.1 + 3.2.2 Gerard Delmàs +3.2.2 ActionScript support 3.2.1 Fixed an issue where context filters would not work 3.2 From ed1d61a2345fc9d5504f196d6a32f2e868f7f60e Mon Sep 17 00:00:00 2001 From: clojj Date: Thu, 5 Mar 2015 00:16:15 +0100 Subject: [PATCH 66/97] adds the Clojure-docset for searches from within Cursive-projects (language "Clojure") --- src/de/dreamlab/dash/KeywordLookup.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 9e1c5b6..27814c1 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -82,6 +82,7 @@ public KeywordLookup() setLanguage("Google Go", "go", "godoc"); setLanguage("Lua", "lua", "corona"); setLanguage("Markdown", "markdown"); + setLanguage("Clojure", "clojure"); /* From a9037d300efd9bdbe800e2c546dc268f475335a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sun, 12 Apr 2015 20:38:49 +0200 Subject: [PATCH 67/97] invoke Dash.app without resigning focus resolves #41 --- .../dash/launcher/AbstractLauncher.java | 7 ++- .../dreamlab/dash/launcher/DashLauncher.java | 56 +++++++++++++++++++ ...her.java => DashPluginSchemeLauncher.java} | 4 +- 3 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 src/de/dreamlab/dash/launcher/DashLauncher.java rename src/de/dreamlab/dash/launcher/{DashSchemeLauncher.java => DashPluginSchemeLauncher.java} (92%) diff --git a/src/de/dreamlab/dash/launcher/AbstractLauncher.java b/src/de/dreamlab/dash/launcher/AbstractLauncher.java index dc79017..0cd8e60 100644 --- a/src/de/dreamlab/dash/launcher/AbstractLauncher.java +++ b/src/de/dreamlab/dash/launcher/AbstractLauncher.java @@ -8,11 +8,14 @@ public abstract class AbstractLauncher { public static AbstractLauncher createInstance() { - if ( SystemUtil.isIsOSLinux() ) { + if ( SystemUtil.isIsOSMac() ) { + return new DashLauncher(); + } + else if ( SystemUtil.isIsOSLinux() ) { return new ZealLauncher(); } else { - return new DashSchemeLauncher(); + return new DashPluginSchemeLauncher(); } } diff --git a/src/de/dreamlab/dash/launcher/DashLauncher.java b/src/de/dreamlab/dash/launcher/DashLauncher.java new file mode 100644 index 0000000..7bc68ec --- /dev/null +++ b/src/de/dreamlab/dash/launcher/DashLauncher.java @@ -0,0 +1,56 @@ +/** + * Created by gerard on 12.04.15. + */ + +package de.dreamlab.dash.launcher; + +import com.intellij.execution.ExecutionException; +import com.intellij.execution.configurations.GeneralCommandLine; +import com.intellij.notification.Notification; +import com.intellij.notification.NotificationType; +import com.intellij.notification.Notifications; + +import java.awt.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URLEncoder; +import java.util.List; + +public class DashLauncher extends AbstractLauncher { + + public void search(List keywords, String query) + { + try { + String request = "dash-plugin://"; + + // keywords + if ( keywords.size() > 0 ) { + request += "keys=" + keywordString(keywords) + "&"; + } + + // query + request += "query=" + urlEncode(query); + + openUri(request); + } + catch ( Throwable e ) { + Notifications.Bus.notify(new Notification("Dash Plugin Error", "Dash Plugin Error", e.getMessage(), NotificationType.ERROR)); + } + } + + private void openUri(String uriStr) throws ExecutionException + { + final GeneralCommandLine commandLine = new GeneralCommandLine("open"); + commandLine.addParameter("-g"); + commandLine.addParameter(uriStr); + commandLine.createProcess(); + } + + private String urlEncode(String s) throws UnsupportedEncodingException + { + return URLEncoder.encode(s, "UTF-8").replace("+", "%20"); + } + +} diff --git a/src/de/dreamlab/dash/launcher/DashSchemeLauncher.java b/src/de/dreamlab/dash/launcher/DashPluginSchemeLauncher.java similarity index 92% rename from src/de/dreamlab/dash/launcher/DashSchemeLauncher.java rename to src/de/dreamlab/dash/launcher/DashPluginSchemeLauncher.java index 559255f..75d739b 100644 --- a/src/de/dreamlab/dash/launcher/DashSchemeLauncher.java +++ b/src/de/dreamlab/dash/launcher/DashPluginSchemeLauncher.java @@ -16,9 +16,9 @@ import java.net.URLEncoder; import java.util.List; -public class DashSchemeLauncher extends AbstractLauncher { +public class DashPluginSchemeLauncher extends AbstractLauncher { - public DashSchemeLauncher() { + public DashPluginSchemeLauncher() { } public void search(List keywords, String query) From b8faf0ddf4faf6ff03f18a08e53254bcdf632d1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sun, 12 Apr 2015 20:45:41 +0200 Subject: [PATCH 68/97] updated version --- META-INF/plugin.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 137d948..64c2c2a 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,7 +1,7 @@ com.paperetto.dash Dash - 3.2.2 + 3.2.3 Gerard Delmàs +3.2.3 + - Dash 2.3 Remote redirection support + - Clojure support 3.2.2 ActionScript support 3.2.1 Fixed an issue where context filters would not work From 549f08fd7a72762547aa56fcff6fabaa4fca2185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Wed, 20 Jan 2016 21:05:49 +0100 Subject: [PATCH 69/97] dockerfile mapping resolves #49 --- src/de/dreamlab/dash/KeywordLookup.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 27814c1..ee3a7fc 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -76,6 +76,7 @@ public KeywordLookup() setLanguage("Scala", "scala", "akka", "playscala"); setLanguage("SSP", "scala", "akka", "playscala"); setLanguage("TypoScript", "typo3"); + setLanguage("Dockerfile", "docker"); // Third-party Plugins setLanguage("Bash", "bash", "manpages"); From 2e2ae43a4eca9e5011570d8c0244e70b9d9bfe28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Wed, 20 Jan 2016 21:36:54 +0100 Subject: [PATCH 70/97] updated version --- META-INF/plugin.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 64c2c2a..bd8b426 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,13 +1,13 @@ com.paperetto.dash Dash - 3.2.3 + 3.2.4 Gerard Delmàs A smart and simple plugin that provides keyboard shortcut access for Dash, Velocity or Zeal in IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm and Android Studio.

 

-

Flattr this

+

Flattr this!

Usage

The default shortcut assigned to search is Cmd-Shift-D (Mac OS X) or Ctrl-Shift-D (Windows, Linux).

@@ -31,6 +31,8 @@ +3.2.4 + - Dockerfile support 3.2.3 - Dash 2.3 Remote redirection support - Clojure support From 36f328804020cf1bb7ed0af12d068d71616f426e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Wed, 20 Jan 2016 21:42:31 +0100 Subject: [PATCH 71/97] mappings for shell commands in dockerfile --- src/de/dreamlab/dash/KeywordLookup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index ee3a7fc..d998348 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -76,7 +76,7 @@ public KeywordLookup() setLanguage("Scala", "scala", "akka", "playscala"); setLanguage("SSP", "scala", "akka", "playscala"); setLanguage("TypoScript", "typo3"); - setLanguage("Dockerfile", "docker"); + setLanguage("Dockerfile", "docker", "bash", "manpages"); // Third-party Plugins setLanguage("Bash", "bash", "manpages"); From df176d8c304b794b8e57876a2c3d2d6d1b13b225 Mon Sep 17 00:00:00 2001 From: Tobias Gall Date: Fri, 14 Oct 2016 19:07:45 +0200 Subject: [PATCH 72/97] Use dash uri for zeal Remove ZealLauncher because Zeal > 0.3.0 supports the dash uri schema. I build the plugin and it works like a charm. fixed #54 may work in windows with zeal too (#36) but not tested --- .../dash/launcher/AbstractLauncher.java | 3 -- .../dreamlab/dash/launcher/ZealLauncher.java | 41 ------------------- 2 files changed, 44 deletions(-) delete mode 100644 src/de/dreamlab/dash/launcher/ZealLauncher.java diff --git a/src/de/dreamlab/dash/launcher/AbstractLauncher.java b/src/de/dreamlab/dash/launcher/AbstractLauncher.java index 0cd8e60..369ec91 100644 --- a/src/de/dreamlab/dash/launcher/AbstractLauncher.java +++ b/src/de/dreamlab/dash/launcher/AbstractLauncher.java @@ -11,9 +11,6 @@ public static AbstractLauncher createInstance() if ( SystemUtil.isIsOSMac() ) { return new DashLauncher(); } - else if ( SystemUtil.isIsOSLinux() ) { - return new ZealLauncher(); - } else { return new DashPluginSchemeLauncher(); } diff --git a/src/de/dreamlab/dash/launcher/ZealLauncher.java b/src/de/dreamlab/dash/launcher/ZealLauncher.java deleted file mode 100644 index da79cc9..0000000 --- a/src/de/dreamlab/dash/launcher/ZealLauncher.java +++ /dev/null @@ -1,41 +0,0 @@ -package de.dreamlab.dash.launcher; - -import com.intellij.execution.ExecutionException; -import com.intellij.execution.configurations.GeneralCommandLine; -import com.intellij.notification.Notification; -import com.intellij.notification.NotificationType; -import com.intellij.notification.Notifications; - -import java.util.List; - -public class ZealLauncher extends AbstractLauncher { - - public void search(List keywords, String query) - { - try { - String queryStr = ""; - - // keywords - if ( keywords.size() > 0 ) { - queryStr += keywordString(keywords) + ":"; - } - - // query - queryStr += query; - - openCmd(queryStr); - } - catch ( Throwable e ) { - Notifications.Bus.notify(new Notification("Dash Plugin Error", "Dash Plugin Error", e.getMessage(), NotificationType.ERROR)); - } - } - - private void openCmd(final String queryStr) throws ExecutionException - { - final GeneralCommandLine commandLine = new GeneralCommandLine("zeal"); - commandLine.addParameter("--query"); - commandLine.addParameter(queryStr); - commandLine.createProcess(); - } - -} From 72064dbc3e55771583d437818af77cdd7a5555fd Mon Sep 17 00:00:00 2001 From: Soorena Date: Thu, 15 Dec 2016 13:32:19 +0330 Subject: [PATCH 73/97] resolving the problem in issue #57 I've added the "angularts" keyword for search javascript files. for better suppport for angular2. --- src/de/dreamlab/dash/KeywordLookup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index d998348..06d7d68 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -33,7 +33,7 @@ public KeywordLookup() setLanguage("CoffeeScript", "coffee", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap"); // not IntelliJ setLanguage("JavaScript", (Object[])FileTypeSpecificKeyword.createList( - new String[]{"javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap", "angularjs"}, + new String[]{"javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap", "angularjs","angularts"}, "ActionScript", new String[]{"actionscript"}) ); From a6b7687bad4c1b303a1219842d985d6c3f1794ec Mon Sep 17 00:00:00 2001 From: Soorena Date: Fri, 16 Dec 2016 18:32:09 +0330 Subject: [PATCH 74/97] Update KeywordLookup.java --- src/de/dreamlab/dash/KeywordLookup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 06d7d68..bb6c294 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -33,7 +33,7 @@ public KeywordLookup() setLanguage("CoffeeScript", "coffee", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap"); // not IntelliJ setLanguage("JavaScript", (Object[])FileTypeSpecificKeyword.createList( - new String[]{"javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap", "angularjs","angularts"}, + new String[]{"javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap", "angularjs", "angularts"}, "ActionScript", new String[]{"actionscript"}) ); From 402f2c8399b15d5a6ae9311b24bc19c61c374d04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delm=C3=A0s?= Date: Fri, 28 Apr 2017 18:00:47 +0100 Subject: [PATCH 75/97] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3b41c1c..e6d3235 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,8 @@ Zeal is a simple offline API documentation browser inspired by Dash (OS X app). ## Troubleshooting -######The plugin does not work on old IDEs +###### The plugin does not work on old IDEs Older IDE versions like **AppCode 1.x** are not supported anymore. Please manually install version 2.2 of the plugin: https://github.com/gdelmas/IntelliJDashPlugin/releases/tag/2.2 -######In rare conditions the installation from the repositories does not work +###### In rare conditions the installation from the repositories does not work It looks like there is an IntelliJ/Java bug with OS X Mavericks which prevents to install plugins from the repositories. Please install the plugin manually from [here](https://github.com/gdelmas/IntelliJDashPlugin/releases). For additional information check [issue #13](https://github.com/gdelmas/IntelliJDashPlugin/issues/13). From b3821692b027d6eccc1438424af726975a7bc40d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delm=C3=A0s?= Date: Mon, 18 Sep 2017 23:10:27 +0100 Subject: [PATCH 76/97] added matplotlib python keyword CLOSES #67 --- src/de/dreamlab/dash/KeywordLookup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index bb6c294..6f2b378 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -61,7 +61,7 @@ public KeywordLookup() setLanguage("PHP", "php", "wordpress", "drupal", "zend", "laravel", "yii", "joomla", "ee", "codeigniter", "cakephp", "phpunit", "symfony", "typo3", "twig", "smarty", "phpp"); // PhpStorm setLanguage("Play", "playjava"); // IntelliJ; uncertain setLanguage("Puppet", "puppet"); // RubyMine, PyCharm - setLanguage("Python", new PythonSdkVersionDependentKeyword("python2", "python3"), "python", "django", "twisted", "sphinx", "flask", "tornado", "sqlalchemy", "numpy", "scipy", "salt", "cvp"); // PyCharm + setLanguage("Python", new PythonSdkVersionDependentKeyword("python2", "python3"), "python", "django", "twisted", "sphinx", "flask", "tornado", "sqlalchemy", "numpy", "scipy", "salt", "cvp", "matplotlib"); // PyCharm setLanguage("ruby", "ruby", "rubygems", "rails"); // RubyMine setLanguage("Smarty", "smarty"); // PhpStorm setLanguage("SmartyConfig", "smarty"); // PhpStorm From 4b8ce6179c74f04649e44f4cf02703e2b1163bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Wed, 1 Nov 2017 19:37:08 +0000 Subject: [PATCH 77/97] removed flattr links --- META-INF/plugin.xml | 2 -- README.md | 2 -- 2 files changed, 4 deletions(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index bd8b426..c2ae498 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -6,8 +6,6 @@ A smart and simple plugin that provides keyboard shortcut access for Dash, Velocity or Zeal in IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm and Android Studio.

-

 

-

Flattr this!

Usage

The default shortcut assigned to search is Cmd-Shift-D (Mac OS X) or Ctrl-Shift-D (Windows, Linux).

diff --git a/README.md b/README.md index e6d3235..36cc146 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ A smart and simple plugin that provides keyboard shortcut access for Dash, Velocity or Zeal in IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm and Android Studio. -[![Flattr this](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/2558535/gdelmasIntelliJDashPlugin-on-GitHub) - ## Installation To install the plugin in your IDE go to **Preferences -> Plugins -> Browse repositories** and **search for "Dash"**. From 8d1570a9c29a3cbe21c2afdb0e1efdcc7bc08e47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Thu, 14 Dec 2017 00:31:50 +0000 Subject: [PATCH 78/97] go mapping for GoLand closes #52 --- src/de/dreamlab/dash/KeywordLookup.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 6f2b378..318e38a 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -66,6 +66,7 @@ public KeywordLookup() setLanguage("Smarty", "smarty"); // PhpStorm setLanguage("SmartyConfig", "smarty"); // PhpStorm setLanguage("Twig", "twig"); // PhpStorm + setLanguage("go", "go", "godoc"); // GoLand // SQL setLanguage("SQL", new SqlDialectDependentKeyword("mysql", "mysql", "sqlite", "psql")); From 6280e6fad9aa6646a44fe9d6ffaedb450d4022d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Thu, 14 Dec 2017 00:42:45 +0000 Subject: [PATCH 79/97] added license --- LICENSE.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..3ea19d6 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2016 Gerard Delmàs + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file From 002e588ca0e784c6932fdc2df410110c983bd8f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Thu, 14 Dec 2017 00:42:58 +0000 Subject: [PATCH 80/97] project settings --- Dash.iml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dash.iml b/Dash.iml index 0e6f704..1dcc234 100644 --- a/Dash.iml +++ b/Dash.iml @@ -7,9 +7,8 @@ - + - - + \ No newline at end of file From f00043e84d423b3ff128f583769abb5a95159f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Thu, 14 Dec 2017 00:52:42 +0000 Subject: [PATCH 81/97] elixir mapping closes #53 --- src/de/dreamlab/dash/KeywordLookup.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 318e38a..dbb29bd 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -85,6 +85,7 @@ public KeywordLookup() setLanguage("Lua", "lua", "corona"); setLanguage("Markdown", "markdown"); setLanguage("Clojure", "clojure"); + setLanguage("Elixir", "elixir"); /* From d9e70636910cc97ec05d76a45a10bed2224f209f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Thu, 14 Dec 2017 00:53:05 +0000 Subject: [PATCH 82/97] erlang mapping closes #61 --- src/de/dreamlab/dash/KeywordLookup.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index dbb29bd..7058c3e 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -85,6 +85,7 @@ public KeywordLookup() setLanguage("Lua", "lua", "corona"); setLanguage("Markdown", "markdown"); setLanguage("Clojure", "clojure"); + setLanguage("Erlang", "erlang"); setLanguage("Elixir", "elixir"); From a3d1907a1540a9bc059ba0aa9aa1968a141260ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Thu, 14 Dec 2017 01:45:31 +0000 Subject: [PATCH 83/97] simplified menu command presentation on win & linux --- resources/velocity.png | Bin 1459 -> 0 bytes resources/velocity@2x.png | Bin 1822 -> 0 bytes resources/velocity@2x_dark.png | Bin 1846 -> 0 bytes resources/velocity_dark.png | Bin 1470 -> 0 bytes resources/zeal.png | Bin 1700 -> 0 bytes resources/zeal@2x.png | Bin 3403 -> 0 bytes src/de/dreamlab/dash/DashLauncherAction.java | 18 ++++++------------ 7 files changed, 6 insertions(+), 12 deletions(-) delete mode 100644 resources/velocity.png delete mode 100644 resources/velocity@2x.png delete mode 100644 resources/velocity@2x_dark.png delete mode 100644 resources/velocity_dark.png delete mode 100644 resources/zeal.png delete mode 100644 resources/zeal@2x.png diff --git a/resources/velocity.png b/resources/velocity.png deleted file mode 100644 index eda7c3ee808f63bdd4a5b934e2f312fe99a2940f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1459 zcmaJ>eN5D57%v}(297x6hPXND3S%1RwY{%i8&2-H)$NYoXw0-+N z@AL6{e$Vr?v%G9ydg}A32!f=$OPm#OeJ1v7PJ!>N`DG3+JJjN8wNmz}VNL;v-7E6| zbqBawPysk^bHgYoK#-&kv8r0F_LQ=M9MEww9bF_4gw_aBP#6hvLLE?19@L7G75n2# zABKuvEB3m{LwbS^;1^3;6j0exRwcC535*vj+=~`OSm+=CR1S><>ZK4Hv0^KJS@<0j z6BxRpqSjflRZ!KQa?~L!05$2%xIj`ylxB34$xJhJKB|X%g0v8N5+@nfWMD}>x^`hO zn&S1b6;9V$EV#2`epL;!1Q8C0bzy@}R%!`~VHkqc6M8)kHSkcgq;e5l3T4MVI6+8I z#Goq55*qW!@p7YT#URqv6aqnyXWg+BS|bWlMnt$ELFq^$5Qycqq8(Bz!2d8d)DBfO z2LVw5LUN-bzYcLC7yy#$c3LrbqVtMg)@-DBlHq;0 zg*O^;BX0mW4`>>4Ya)S<6Bx=z#{Fz$@3I?;j24H5Ht1axRcy4=7IRUtp0QB0!$C6o zxUE|XshlK$cx(~IUbCg2YRftlz^SrQCCl~kE-3fQsvPpmLDb<`sXDsb!wI4k6Yhx> zYBg^sP{bzSbt!THU16FPH$Y*gX^v(LBo0glGj0To59chL9v2vahBt5Vawcre-uncD ztDOoZFq2>$5DQ2%O#zD$=Xu72Qxv3)PH4^pvUTb%y)Bj3K1 zeB}K03FJ(!2G#s9GB&EK`Rr^znmhE*)St)0C-*;k@zK}cyz{%``qlZ)k(3@(JikfI z*fs;^nr;i^-AZq7%i|q`vzokTb1rmu%Zt;R(t|U4iix%)px62npZjUc#RD(Ba<9v7 zcOBtwoi=E{`04>UV(q89Ji zz4UO3teKwGT+#mgawh6WN~sYv>QjH*YD9dS(}*qYuZjudc?YFQY!Zofgon%e2WQ5X z+IRouygW7W>%%#lqiOGCwXJu`ko55}a`62Dg?wQT-fC;Qp3vH{*fO8-o18P2);7L% zLi4U|Co+`!R^PS9?RU0a>PepIM8^(%xyy>2b(X*3y7hhkiNrevS)YU66oZ<$)*hEA@ho0ipc~e()H^)PC%tM%h%2E*LAD+2Oe!uTG-_Q5^`Myfy zW0y>w^6?ZNk2f_cQklS=faB%6a$jqH{xj~F!>Ur)M8?485*Csdu4l9)5JeH`WCBU( z^S)>&LwLN2>y4TeHbosH(=n8QaM%cJl$k^Gcp+gnGodq)ETARRjkFx>`>7cOjCwhk zEK!TpW(ApHjLf%?iTSY_UA{?&>%p*4AjBr)98e@n05&R%w#saBaMZ7iyF1iE5EwOK zO>%IIREjztP%st}kO+byod`w&DK3B|!BSkh5D;^+P=pD^B1nYGB#2BT2Hrd%7tNwK z$P$!`-^Ai1Ihet+W|>f!o0}`hMFfl`T?peiE)KkEjq3r2Jdk&SGx}fau{-KWN{WF*Aya4$>_2vl4hfna*+EY&>QtKL@PGH zgam^y34%kY2-ZS4ieV5UK@lB}NpM(1jQe>XesMSwfno}U6cI0mVHFxK#eySLVjP2| z3WW$4k7J`~D@)Kiay+(?i~R;0@jb!W-w+zp&0Et;IAfh zM%tkaa5QQxZzX9l=8*cu7KQ>wD=jm=hlO5*!cuK80vQNW1fdwJg)pfUflvg+5sbtz zlHjr!!|UIv;Mk;c8ZHy_I3XE{!3c(6Vo0mSB@hftr4WHjf*}kSkpwD5wHPS@g&akp zV|d;frg0TFp^od@)!>A;%SF=MMp?Mk@k!&yaT_U!Qif}6caA07KT9M$)@+FkI?=Y# zYri%~y!lX4(MM}(d$GHsDD<>{%ckxF;m-CQs*%D?f*-rjEngV8F7)SpRjge(M?Bj* z*!y6rx?gu(6<9qGa( z!&eFROaa@Fe0c=97k!Pt!1r8(hoFs`ba;AsU=(G08r>@1S$$zzSbE|=U40WqQfEx= zj*e^Wn-yJN*pRw@c;!UT+$ZiX(|yxd`yK4Me#Ufi4-J#ES6#tdwC&?9=PJwTTJ@pEF?=$3kN;8#uXh2a&2PCQVw&dnJ2lG_{}FG>}wtczH=?mvSEzc~N^ diff --git a/resources/velocity@2x_dark.png b/resources/velocity@2x_dark.png deleted file mode 100644 index a70f6d03ebec3513cb4c5c8455097ba899599738..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1846 zcmaJ?X;c$e6pj+BazqHOD9RWR0Zk@5nMhc&u+*RsA|PrZ%Roj*CL{xdh%5>guxcq4 zcSQ>d9)%-_qIDs~wH8s7vJ_>hXsK3I^eC>KfY|;}=bV}M?tAyU_q*GfypY8KHr6w& z2?T;oP@qVPuYlzp_Z9v%m`u;`#Q_sXVqs`3mLk`~1V0t3fPo;5JPww^a#d>L71)bF zu+ky2NGvi~!c(Fes@$SOHEMJ?nn3XKG3w;Xco+i|a2%rLlly-@M+OiTpB%vsrUmPS zuo?+8>ESTbVwutuuY^=&A8)|R$ioe2U`!4eH3?b+&&Vea+2!GT%P~j>hE%Y4K6#i_ zWN-)|MD;MhrgA7s8l44rLR31N;|X~#02sIo(zqalMxjAGHj_tV03RMQ?oF?X(g zEnu-ISD;B4pNumd4nd;}4*qCZYxs~TJY}F!t^?^*8mQ4&;u_L6U{d%$8lTiQ$WnDM zD1{AZl3t0|Bi4BYjOXsljx35e8{QHd!lgaR>)5R=5PcBCwW%MgeDiLUtUtq2nN$&BsCB9=&Q#!Swz8|^0CP%viPFEYE0 z{$kVP7~-=obGB~4b}YL)=5(MyBJq;g-s!%WRZlY)Pun=&bfe2E+2o-`ggiSN8Ol zJB=}&N5V4CZ)6-*7|hrH34AE%v2HCYJo4Kt>tNq=;Q5W#(H*bHcAED@&$+xT+_76y zO2}KTQe3#V2F|H-N)8HTE-3D`%A)_}G(D?1)9F{M{_c)jjnB8%g%nGV*k^Q&?LgwJE^{*^{IU+ zX+56b_4clDT6O03+=(x5J+If;WtNrtoK&Or+m%72tDJh#ld>sR_tdHeE007ARlAnxj#2g`{E%HMKwdb#Lu zO~xY4r?7WBJ z$W5``4%Bx6S8*+iNIgi*Zz`)7)P{JuX+-m=g^L&D_kwcGclg*_pqp6aO<*Li4T)#`qHc9!NBx{gk)$BpIq}Sn zj>lJWbr}()X%26^luh@jj+#J^10Apff7hKnN&b=eidvi2j+~O&VY`(o`?Ehzq%>ER ku62#7X_#FNy_#1?_*Rv3z_`B1!}2E!5-%222x8X$3y~wql>h($ diff --git a/resources/velocity_dark.png b/resources/velocity_dark.png deleted file mode 100644 index 56a075210ba2b699d07b1656a9f2435b863492dc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1470 zcmaJ>ZA=qq96w&lKw+{Ok>a9fF@zb~dugG)OK+vNAYE+50vqvz>D~1yT%dR7^`NC= zgUGUoSwvZ~B{DaR@@30drwi&}y5Y;}2F{m6Gcui3HYjw+e!wEJuait*qJcH$6@HZkn2>l|?O=)yh?ZPY%)&fUI7D0kFeQ z*8w-6y)ApM05b%oh+K88TJ5i@-1NB@*SOQgHS2Y`MU>J||o zZV(WfBvz@1FF!$6a`$XQaiHQ2xl`hlqR@?Yfo<{wUUt|ijdG*&a$d5;fH5e+__QX* zV9**EJbRCjfpO(tQTY87D@U-%^{$Y;C9dgzxrpKn5^t0Lv`ykj z>BabVc?c9?d5i$B%#NfCiT;>Z8L^~?4!gBFG{(%#&s#b=J2O(qYXO%7a!;4e#BSUr z4x*1XS>8f_KC?GvWNvDFP0H#c1u9r|EBfu#g5Kj>ufWkCXG?c}y*YN}`g?PEw_R@* z4hG3b6Th4nsiKO!KdeVo(`R!V->p%9S<|QflM0WD{>KHXft%aMH&}+UZcWb3KD`JS z34WYh+M4v+zS+_Z>xL<3?v_icT-VW|%aOijb;rF+RhcI(=kWceF|2UM1oK3iD!K4} z%j$`?uUc!8KIwYF*FN0!@%h{w-gFtBeWdER+h3D;V5T(_&p7NE-E{Rs_ROK~OOp?N z3Pg5$g;TxHeKhvz)6BMW$^NEhsKK;$<9CzeQ*~#C_8+G@%B!@M=A6MKbdtIGnyJV3 z>WlT!^${z6J?7~+)=zsF7}_#3q%IoxtgbRzL3?7qf@~B^ej_6-JrAnN#M4ix?=+=m zwX27Rf4I==-VOcz{Rcg#_Zy)Tu{&R^os5J|&BF)GyL6#}FlD}W=xCQQCtLSqR;-UtDnE8e|Wp+w5Khf+XG!Z7}cex-iIo;K6o;9bAC-qN76tf^?oNj zy6f|e6qI4#cLNVM^Xt0NP}}tHt!Zy>USFEW?y>A?k5QiHv~(20&PKayuB%+}KdPh5 KW$)kS+4m3d(+(a0 diff --git a/resources/zeal.png b/resources/zeal.png deleted file mode 100644 index 4cd2b3f0dd52bbc591b933380dd7d9b60b1dc695..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1700 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+m^Cs(B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxOgGuU&_u!9QqR!T z%-qskN5Kfl*Eg`xH!{#Qu(UEYwlXkMfC43;ZAB?*RzWUqP`iLUTcwPWk^(Dz{qpj1 zy>er{{GxPyLrY6beFGzXBO_g)3fZE`@j@w*YQzUNJP7fB~jokyxN_sAmB35=^15FMg%Dxp39RB|)hO_hL1;IHa;5 zRX-@TIKQ+g85nVC${?!>telHd6HD@oLh|!-V4)b0kzbNuoRMFk;OqX$Y%oHnE6GumLBV!YDV#4B|o_|H#M&WrZ)wl*A%B-P=d%U0NU)5T9jFqn&MWJpQ`}&xK$=@w;16x z52`l>w_A*H>eUB2MjsTtNYM=w0;VAl6P|d19C-3i%>$J73mS|3nBq-f(J$hF{s;)Es*2d77xOFT3)n0SRA z$uC&o7|^H@Fr}@HE0E3A#9@L{l4DnPcY)~fvURodf6uu4aLwZ#kJg-f^XA2yneVOd zFTYp&`D^Ri!cVCixBh$M-miC|i)Zng1w7AXT9fU$ewuNGOmyB_m-ubr@$)nMmVZ8+ zUmsWb=EftY-m@)|Nj1w)PLi0dB691&7B%^I4CVKP zOtaID6nd$tKK49y?5cN&zs*_O_w`=0o-O&yxO3|y)4=@$oa-c8P?Ophd zKVO+XDm?vXEH5k@llFA-_KmBxO~m;ori;Dh;z}-lT*-Cb_(?U#CY{93>$8hqbMoyk zo%Ydw^`E~tBW-41m=mue-@ha-cuHhMddjxl?3P`H^&U?SKYGcZX=y4gQjbh*Nnr=T(#__dRO{R{ImPiQ~rAgX6IepQ7vaWbAgS#en-Hm z^op2 zzS)ODr}hh-=UTNXP%`WMtxXe-CR;t^`PXZj`s!?ET=mn?c{Q(8%vK4X+Om2o*D>>q zjUV(H_Abqtu=LTDw{o}lD&E|wza`SHXv@b#-RBKEgqc3NYo*n@i~g{m^Q^yZ0wzg+oh zx?WtMx3~B4>%ShazaN>Szdxj%w_E$={j|UK3%8zXs}0@1b)S)v&ENS9%naWGYh0_= Rs(OR!4Nq4;mvv4FO#tJ|r*QxP diff --git a/resources/zeal@2x.png b/resources/zeal@2x.png deleted file mode 100644 index 6428d44e917222c320fcc706ac49dde13435198e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3403 zcmaJ^c{r4N{}yqEM6#77V;rF{o575o8DnW8928=ViNP#pM)q`u$jMqUwAf9q5=Dh% z%`Oa5S&FhHNzrL+@s8fpd4GSL^LwuAdA{Gz=eqCvv;OlWIUdLE6;lus5D?gFYlC*; zpTM0LAj1DLA|t=@kAqB%JJXqZh8c#Z69p{%sJ=v?EgA1mbRy#YB0{=|#sUIDnj{x@ zraSH!ia;gn;&(8*;ba=0Eg)cQ7EZ$xf{09@FVUYwF##>rHG+U7KNFA}0tdm-tcU?5 zn@Bp*Ir6v*Au@=7^aGih0*%8_d;v0%i3f(0gDDJDxC!WoE{cEOaf3m?9}s4c3FyB` zx#JvxR#Z9>h|ty7AwZydKm(*M6rpc`G|&dZ_%;|~2!=s)AV?Gfj)K5|e?1_6G`imz zloQ(euULG`1Qftz(okSrfbKKNZkK z27ykZF-cSka7PjEOATe3fcTmIw*)fnZ&?cCuQu@;1`fy5z))StPDww3INbjaC6oU~ zGnh`q|Kf*@f(xo9dOluV>Be{%i)$A$hYcV{8UG=5|>kxn{G^s}Z@$-p0lqe%ad z3j~UUK`pJV|5fiVuHQf8@`Gyy`S&`&{A9p8ecHuRoE(-+4NJ zxw8RYrv(H=Yi-dMF5#nB-N?zFMA>t1HV|Q-o_*~2c(!hl;t^2&;DKhZb@6%Dd6nkY zN9{IkK9K#6?fYPG&?&3Z>v7%9 zdZQ{hZy_e8FUo(HJwOb7X+Ou;*5Cbh(cB@=17`&^_P3fVwk6p1F|#LUWkwcz8~1@9s{ zQ!G!(e9ruRq2~R7P3|0^?e;SHX}&JtAaZ_<<$mP{zvRZ^xVtQ@i`{#zn% zSu<|osHVaYGkNyyAasP2oZuma^^8BQ92;33C+}^z{M2Y^IghdM@cm~y4c8*IqI8Eu zM{>{$npFxH-hH+JP-5NgpA>Qc(U@e{9VdNle(*7x&DFB_b)cJbWcacmXgBJZ9_(a) z=uzaohvhU>UxtS5Q=_QaUM92GU7fJ|kf$}^K`r!XwhtwL1t_9_1gCaQRs9l!8~ud0@fKvSx7k>~qzVn;u4Px<)C zq~-&YIMS^~_Lo_hmi_ZzX>VJQg{AK=Cho!vLWGg^GT7D{4zJWjbX)Mvx#c-OL&>}7 zV{vKUJm96}-j^J<)&cmuCVO72gndV9enW^5t6e~^$GKAraDcFly*%4VC*Sy04d?QQ zwMnZvE*)TgF5SFV2I=hhN>64p>vB((c%aX2i4)xJwn0Vsf$bL4@h>gHoaz0kpI)ch zYor24BlpT=40}@Fm%Tk_sF2+!>y@3#rqymrMjlZ#Wlagi&BFP4uU=8ja###wjX>apj6*(64Iss;^U zwa7l-`is4G^;N|?n{{$&B|w{aR_NgsMGDc-Pd|DMfg>W%Q8L|nq$JtI_xIfSnV-a&- z!J_hmwiKb$Gw$LbxpeH1qve%3t(U_3(n5z5u~NXj89W%L$!A${qUD>4G3$x)6xaXc zR7bzh=f@V|!wM_8gZHi`&sTX)`geD3ZNAfP|1_HRv1QC=!c@4;Za?MM!gR;nTV1V9 zmmm!k>8w-G$a>wVU6>1iwavTkfko9ZqS70Uy@8#y<)l0aKwhzN{h(iueW#{r#5gOX zk3$w&oGEq{gsk;0HTi2jN<9=WkI-hUcc_Xp&L&MGz@w zuaVm^Ugc0QIT|qJD!#aCsP-EGbCs2z!g(SyR<2nHoP7DAlswKVt77F~RUUAA)W`FY zXKnHN$aMRvt}Ln6gCG7>xb_smoGj9anMmxtTdI6ea9_r^iS0n7YD8!eidAr!HG81t zi>-@w`(#=&TjI;fg<&?7SEmu6S=}!__LzoaVqmk6bEmq*9WO;ce}5mHxq|mH6j0qa z5*Y6u?EFLtd-Es(iidBY8Z%iI%eBp*Bd zW@cqqZdB#)g+}sGR$Ixlg-e;QHEU%#-e@6tWQ1Olf0^<^jc^gQXWodg{#bSXo|kjB zQ{c&wC+k6rM?_ig&ZZXQ9xYkM)TZPxmIC|pl`4KEJ#62nFxp|$LJv;$g^CY=4#osp zHc?&_q31jmPnnd!2G!X8M{)_b4oOvrtt@ms(WJ=E9J6^8Vs}I;#67Nv!3d9hl$e6| zGoGiUtOK15<8x}&ne+C}9Wwb!D>uT6503PT#e|R8>9qIVPAJ;=eUlTDZ1>zxC-{#= zlez-KwZYLKNYv9ap0UgQGL?Y}4rdUkH^qkU~5$?2`q6?f;##LRei39uof?aV(Ut(v|{*+iVR zOJYyJZcIz?=t0Hj3sT-0;2)Rwi9;O^-Q-F2NqRZg#+sQ-9= z#Y~Ay^vG)dt=(|e$WM_Xo;tZXZ!i$GZm{YSCKp1SEE}zl;yu0Pkhk?IOUL Date: Thu, 14 Dec 2017 01:54:17 +0000 Subject: [PATCH 84/97] updated version --- META-INF/plugin.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index c2ae498..5bbde7a 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,7 +1,7 @@ com.paperetto.dash Dash - 3.2.4 + 3.2.5 Gerard Delmàs +3.2.5 + - Fixed Zeal Support + - Go, Elixir & Erlang support 3.2.4 - Dockerfile support 3.2.3 From 21fe246519b733724d16b57b808dfb4cad544bae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Thu, 14 Dec 2017 02:03:28 +0000 Subject: [PATCH 85/97] updated readme --- META-INF/plugin.xml | 8 ++++---- README.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 5bbde7a..29a05a8 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -5,25 +5,25 @@ Gerard Delmàs A smart and simple plugin that provides keyboard shortcut access for Dash, Velocity or Zeal in IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm and Android Studio.

+

A smart and simple plugin that provides keyboard shortcut access for Dash, Velocity or Zeal in IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm, DataGrip, CLion, GoLand and Android Studio.

Usage

The default shortcut assigned to search is Cmd-Shift-D (Mac OS X) or Ctrl-Shift-D (Windows, Linux).

-

A menubar command named either "Search in Dash" (Mac OS X), "Search in Velocity" (Windows) or "Search in Zeal" (Linux) can be found in the "Tools" menu.

+

A menubar command named either "Search Documentation" can be found in the "Tools" menu.

The plugin either searches for the statement at caret position or the current selection. It will identify the programming language in use and request filtered results accordingly.

Configuration

Shortcut

You can change the shortcut at Preferences -> Keymap -> Plug-ins -> Dash.

Toolbar Icon

-

You can add a "Search in Dash/Velocity/Zeal" button to the toolbar. Right-click the menubar -> Customize […]. You will find the button under "Plug-ins -> Dash".

+

You can add a "Search Documentation" button to the toolbar. Right-click the menubar -> Customize […]. You will find the button under "Plug-ins -> Dash".

Supported API Documentation Browsers

Kapeli Dash (Mac OS X)

Dash is an API Documentation Browser and Code Snippet Manager. Dash stores snippets of code and instantly searches offline documentation sets for 150+ APIs (for a full list, see below). You can even generate your own docsets or request docsets to be included. http://kapeli.com/dash

Velocity (Windows)

Velocity gives your Windows desktop offline access to over 150 API documentation sets (provided by Dash for OS X). https://velocity.silverlakesoftware.com

-

Zeal (Linux)

+

Zeal (Linux & Windows)

Zeal is a simple offline API documentation browser inspired by Dash (OS X app). http://zealdocs.org

]]>
diff --git a/README.md b/README.md index 36cc146..55bb1db 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -A smart and simple plugin that provides keyboard shortcut access for Dash, Velocity or Zeal in IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm and Android Studio. +A smart and simple plugin that provides keyboard shortcut access for Dash, Velocity or Zeal in IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm, DataGrip, CLion, GoLand and Android Studio. ## Installation To install the plugin in your IDE go to **Preferences -> Plugins -> Browse repositories** and **search for "Dash"**. @@ -7,7 +7,7 @@ To install the plugin in your IDE go to **Preferences -> Plugins -> Browse repos The default **shortcut** assigned to search is **Cmd-Shift-D** (Mac OS X) or **Ctrl-Shift-D** (Windows, Linux). -A **menubar command** named either "**Search in Dash**" (Mac OS X), "Search in Velocity" (Windows) or "Search in Zeal" (Linux) can be found in the "Tools" menu. +A **menubar command** named "**Search Documentation**" can be found in the "Tools" menu. The plugin either searches for the statement at caret position or the current selection. It will identify the programming language in use and request filtered results accordingly. @@ -17,7 +17,7 @@ The plugin either searches for the statement at caret position or the current se You can change the shortcut at Preferences -> Keymap -> Plug-ins -> Dash. ### Toolbar Icon -You can add a "Search in Dash/Velocity/Zeal" button to the toolbar. Right-click the menubar -> Customize […]. You will find the button under "Plug-ins -> Dash". +You can add a "Search Documentation" button to the toolbar. Right-click the menubar -> Customize […]. You will find the button under "Plug-ins -> Dash". ## Supported API Documentation Browsers ### Kapeli Dash (Mac OS X) @@ -28,7 +28,7 @@ Dash is an API Documentation Browser and Code Snippet Manager. Dash stores snipp Velocity gives your Windows desktop offline access to over 150 API documentation sets (provided by Dash for OS X). [https://velocity.silverlakesoftware.com](https://velocity.silverlakesoftware.com) -### Zeal (Linux) +### Zeal (Linux & Windows) Zeal is a simple offline API documentation browser inspired by Dash (OS X app). [http://zealdocs.org](http://zealdocs.org) From 4505bf929e4465b39b8a64250fb9b720f2c6b4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Fri, 15 Dec 2017 23:23:45 +0000 Subject: [PATCH 86/97] simplified String.join with Java 8 --- .../dash/launcher/AbstractLauncher.java | 23 ------------------- .../dreamlab/dash/launcher/DashLauncher.java | 2 +- .../launcher/DashPluginSchemeLauncher.java | 2 +- 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/src/de/dreamlab/dash/launcher/AbstractLauncher.java b/src/de/dreamlab/dash/launcher/AbstractLauncher.java index 369ec91..c7ebee5 100644 --- a/src/de/dreamlab/dash/launcher/AbstractLauncher.java +++ b/src/de/dreamlab/dash/launcher/AbstractLauncher.java @@ -17,27 +17,4 @@ public static AbstractLauncher createInstance() } public abstract void search(List keywords, String query); - - protected String keywordString(final List keywords) throws Exception - { - if ( keywords.size() > 0 ) { - String result = ""; - boolean first = true; - - for (String keyword : keywords) { - if ( !first ) { - result += ','; - } - - result += keyword; - - first = false; - } - - return result; - } - else { - throw new Exception("empty keyword list"); - } - } } diff --git a/src/de/dreamlab/dash/launcher/DashLauncher.java b/src/de/dreamlab/dash/launcher/DashLauncher.java index 7bc68ec..fc6ad6c 100644 --- a/src/de/dreamlab/dash/launcher/DashLauncher.java +++ b/src/de/dreamlab/dash/launcher/DashLauncher.java @@ -27,7 +27,7 @@ public void search(List keywords, String query) // keywords if ( keywords.size() > 0 ) { - request += "keys=" + keywordString(keywords) + "&"; + request += "keys=" + String.join(",", keywords) + "&"; } // query diff --git a/src/de/dreamlab/dash/launcher/DashPluginSchemeLauncher.java b/src/de/dreamlab/dash/launcher/DashPluginSchemeLauncher.java index 75d739b..9929136 100644 --- a/src/de/dreamlab/dash/launcher/DashPluginSchemeLauncher.java +++ b/src/de/dreamlab/dash/launcher/DashPluginSchemeLauncher.java @@ -28,7 +28,7 @@ public void search(List keywords, String query) // keywords if ( keywords.size() > 0 ) { - request += "keys=" + keywordString(keywords) + "&"; + request += "keys=" + String.join(",", keywords) + "&"; } // query From dc19a2e5c8a239092648f508bff36def67487dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Fri, 15 Dec 2017 23:35:46 +0000 Subject: [PATCH 87/97] simplified launcher classes --- .../dash/launcher/AbstractLauncher.java | 33 ++++++++++++++- .../dreamlab/dash/launcher/DashLauncher.java | 39 +----------------- .../launcher/DashPluginSchemeLauncher.java | 41 ++----------------- 3 files changed, 37 insertions(+), 76 deletions(-) diff --git a/src/de/dreamlab/dash/launcher/AbstractLauncher.java b/src/de/dreamlab/dash/launcher/AbstractLauncher.java index c7ebee5..51e4ef8 100644 --- a/src/de/dreamlab/dash/launcher/AbstractLauncher.java +++ b/src/de/dreamlab/dash/launcher/AbstractLauncher.java @@ -1,7 +1,13 @@ package de.dreamlab.dash.launcher; +import com.intellij.notification.Notification; +import com.intellij.notification.NotificationType; +import com.intellij.notification.Notifications; import de.dreamlab.dash.SystemUtil; +import javax.annotation.Nonnull; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.util.List; public abstract class AbstractLauncher { @@ -16,5 +22,30 @@ public static AbstractLauncher createInstance() } } - public abstract void search(List keywords, String query); + abstract protected void openUri(String uriStr) throws Exception; + + public void search(final @Nonnull List keywords, final @Nonnull String query) + { + try { + String request = "dash-plugin://"; + + // keywords + if ( keywords.size() > 0 ) { + request += "keys=" + String.join(",", keywords) + "&"; + } + + // query + request += "query=" + urlEncode(query); + + openUri(request); + } + catch ( Throwable e ) { + Notifications.Bus.notify(new Notification("Dash Plugin Error", "Dash Plugin Error", e.getMessage(), NotificationType.ERROR)); + } + } + + private String urlEncode(final @Nonnull String s) throws UnsupportedEncodingException + { + return URLEncoder.encode(s, "UTF-8").replace("+", "%20"); + } } diff --git a/src/de/dreamlab/dash/launcher/DashLauncher.java b/src/de/dreamlab/dash/launcher/DashLauncher.java index fc6ad6c..3212a15 100644 --- a/src/de/dreamlab/dash/launcher/DashLauncher.java +++ b/src/de/dreamlab/dash/launcher/DashLauncher.java @@ -4,43 +4,13 @@ package de.dreamlab.dash.launcher; -import com.intellij.execution.ExecutionException; import com.intellij.execution.configurations.GeneralCommandLine; -import com.intellij.notification.Notification; -import com.intellij.notification.NotificationType; -import com.intellij.notification.Notifications; -import java.awt.*; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URLEncoder; -import java.util.List; +import javax.annotation.Nonnull; public class DashLauncher extends AbstractLauncher { - public void search(List keywords, String query) - { - try { - String request = "dash-plugin://"; - - // keywords - if ( keywords.size() > 0 ) { - request += "keys=" + String.join(",", keywords) + "&"; - } - - // query - request += "query=" + urlEncode(query); - - openUri(request); - } - catch ( Throwable e ) { - Notifications.Bus.notify(new Notification("Dash Plugin Error", "Dash Plugin Error", e.getMessage(), NotificationType.ERROR)); - } - } - - private void openUri(String uriStr) throws ExecutionException + protected void openUri(final @Nonnull String uriStr) throws Exception { final GeneralCommandLine commandLine = new GeneralCommandLine("open"); commandLine.addParameter("-g"); @@ -48,9 +18,4 @@ private void openUri(String uriStr) throws ExecutionException commandLine.createProcess(); } - private String urlEncode(String s) throws UnsupportedEncodingException - { - return URLEncoder.encode(s, "UTF-8").replace("+", "%20"); - } - } diff --git a/src/de/dreamlab/dash/launcher/DashPluginSchemeLauncher.java b/src/de/dreamlab/dash/launcher/DashPluginSchemeLauncher.java index 9929136..42aa6c6 100644 --- a/src/de/dreamlab/dash/launcher/DashPluginSchemeLauncher.java +++ b/src/de/dreamlab/dash/launcher/DashPluginSchemeLauncher.java @@ -4,52 +4,17 @@ package de.dreamlab.dash.launcher; -import com.intellij.notification.Notification; -import com.intellij.notification.NotificationType; -import com.intellij.notification.Notifications; - -import java.awt.Desktop; -import java.io.IOException; -import java.io.UnsupportedEncodingException; +import javax.annotation.Nonnull; +import java.awt.*; import java.net.URI; -import java.net.URISyntaxException; -import java.net.URLEncoder; -import java.util.List; public class DashPluginSchemeLauncher extends AbstractLauncher { - public DashPluginSchemeLauncher() { - } - - public void search(List keywords, String query) - { - try { - String request = "dash-plugin://"; - - // keywords - if ( keywords.size() > 0 ) { - request += "keys=" + String.join(",", keywords) + "&"; - } - - // query - request += "query=" + urlEncode(query); - - openUri(request); - } - catch ( Throwable e ) { - Notifications.Bus.notify(new Notification("Dash Plugin Error", "Dash Plugin Error", e.getMessage(), NotificationType.ERROR)); - } - } - - private void openUri(String uriStr) throws URISyntaxException, IOException + protected void openUri(final @Nonnull String uriStr) throws Exception { Desktop desktop = Desktop.getDesktop(); URI uri = new URI(uriStr); desktop.browse(uri); } - private String urlEncode(String s) throws UnsupportedEncodingException - { - return URLEncoder.encode(s, "UTF-8").replace("+", "%20"); - } } \ No newline at end of file From 85aeb16bb0bca50df35253973b3af024f202595b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sat, 16 Dec 2017 00:11:52 +0000 Subject: [PATCH 88/97] refactored main Action --- META-INF/plugin.xml | 2 +- src/de/dreamlab/dash/DashLauncherAction.java | 221 ------------------- src/de/dreamlab/dash/SearchService.java | 197 +++++++++++++++++ src/de/dreamlab/dash/SmartSearchAction.java | 67 ++++++ 4 files changed, 265 insertions(+), 222 deletions(-) delete mode 100644 src/de/dreamlab/dash/DashLauncherAction.java create mode 100644 src/de/dreamlab/dash/SearchService.java create mode 100644 src/de/dreamlab/dash/SmartSearchAction.java diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 29a05a8..dfc01bd 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -87,7 +87,7 @@ - + diff --git a/src/de/dreamlab/dash/DashLauncherAction.java b/src/de/dreamlab/dash/DashLauncherAction.java deleted file mode 100644 index a7104bf..0000000 --- a/src/de/dreamlab/dash/DashLauncherAction.java +++ /dev/null @@ -1,221 +0,0 @@ -package de.dreamlab.dash; - - -import com.intellij.lang.Language; -import com.intellij.lang.injection.InjectedLanguageManager; -import com.intellij.notification.Notification; -import com.intellij.notification.NotificationType; -import com.intellij.notification.Notifications; -import com.intellij.openapi.actionSystem.*; -import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.editor.SelectionModel; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.util.IconLoader; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.wm.impl.status.StatusBarUtil; -import com.intellij.psi.PsiComment; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiFile; -import de.dreamlab.dash.launcher.AbstractLauncher; - -import javax.swing.*; - -public class DashLauncherAction extends AnAction { - private static final String XML_LANGUAGE_ID = "XML"; - - private KeywordLookup keywordLookup; - private AbstractLauncher launcher; - private boolean isPresentationInitialized = false; - - public DashLauncherAction() - { - keywordLookup = new KeywordLookup(); - - launcher = AbstractLauncher.createInstance(); - } - - private void initPresentation() - { - String docAppName = ""; - - if ( SystemUtil.isIsOSMac() ) { - docAppName = " in Dash"; - } - - Presentation presentation = this.getTemplatePresentation(); - presentation.setText("Search Documentation" + docAppName); - presentation.setDescription("Searches documentation for word under caret or selected text" + docAppName); - - Icon icon = IconLoader.getIcon("/dash.png", DashLauncherAction.class); - presentation.setIcon(icon); - } - - @Override - public void update(AnActionEvent e) { - super.update(e); - - Presentation presentation = e.getPresentation(); - - if ( !isPresentationInitialized ) { - isPresentationInitialized = true; - initPresentation(); - - Presentation templatePresentation = getTemplatePresentation(); - presentation.setText(templatePresentation.getText()); - presentation.setDescription(templatePresentation.getDescription()); - presentation.setIcon(templatePresentation.getIcon()); - } - - presentation.setEnabled(PlatformDataKeys.EDITOR.getData(e.getDataContext()) != null); - } - - public void actionPerformed(AnActionEvent e) { - final Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext()); - if ( editor == null ) { - return; - } - - final Project project = e.getProject(); - final PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE); - final VirtualFile virtualFile = e.getData(LangDataKeys.VIRTUAL_FILE); - - PsiElement psiElement = null; - Language language = null; - - if ( psiFile != null ) { - int caretOffset = editor.getCaretModel().getOffset(); - - if ( project != null ) { - InjectedLanguageManager injectedLanguageManager = InjectedLanguageManager.getInstance(e.getProject()); - - if ( injectedLanguageManager != null ) { - psiElement = injectedLanguageManager.findInjectedElementAt(psiFile, caretOffset); - } - } - - if ( psiElement == null ) { - psiElement = psiFile.findElementAt(editor.getCaretModel().getOffset()); - } - - language = elementLanguage(psiElement); - } - - String query; - String resolvedLanguage = keywordLookup.findLanguageName(language); - - SelectionModel selectionModel = editor.getSelectionModel(); - if ( selectionModel.hasSelection() ) { - query = selectionModel.getSelectedText(); - } - else { - if ( psiElement == null || psiElement instanceof PsiComment || resolvedLanguage == null ) { - query = getWordAtCursor(editor); - } - else { - query = psiElement.getText(); - } - } - - if ( query != null ) { - // show status message for potential troubleshooting - final StringBuilder messageBuilder = new StringBuilder(); - - if ( resolvedLanguage == null ) { - messageBuilder.append("Searching all docsets in Dash"); - } - else { - messageBuilder.append(String.format("Searching \"%s\" docsets in Dash", resolvedLanguage)); - } - - if ( language != null && !language.getID().equals(resolvedLanguage) ) { - messageBuilder.append(String.format(". Based on \"%s\" context.", language.getID())); - } - - if ( project != null ) { - StatusBarUtil.setStatusBarInfo(project, messageBuilder.toString()); - } - - // open dash - launcher.search(keywordLookup.findKeywords(new LookupInfoDictionary(language, psiElement, project, psiFile, virtualFile)), query); - - /* - use the following command to display information about the sdk in use in the event log. intended for development purposes. - showSdkDebug(AbstractSdkKeyword.findSdk(psiElement, project, psiFile, virtualFile)); - */ - } - } - - private void showSdkDebug(Sdk sdk) - { - StringBuilder sdkMessage = new StringBuilder(); - - if ( sdk != null ) { - sdkMessage.append(String.format("Name: %s\n", sdk.getName())); - sdkMessage.append(String.format("SdkType: %s\n", sdk.getSdkType().getName())); - sdkMessage.append(String.format("VersionString: %s\n", sdk.getVersionString())); - - } - else { - sdkMessage.append("not available"); - } - - Notifications.Bus.notify(new Notification("Dash", "Dash SDK: ", sdkMessage.toString(), NotificationType.INFORMATION)); - } - - private Language elementLanguage(PsiElement element) - { - if ( element == null ) { - return null; - } - - try { - if ( XML_LANGUAGE_ID.equals(element.getLanguage().getID()) ) { - PsiElement parent = element.getParent(); - - if ( !XML_LANGUAGE_ID.equals(parent.getLanguage().getID()) && XML_LANGUAGE_ID.equals(parent.getLanguage().getBaseLanguage().getID()) ) { - return parent.getLanguage(); - } - } - - return element.getLanguage(); - } - catch ( NullPointerException e ) { - return null; - } - } - - private String getWordAtCursor(Editor editor) { - CharSequence editorText = editor.getDocument().getCharsSequence(); - int cursorOffset = editor.getCaretModel().getOffset(); - int editorTextLength = editorText.length(); - - if ( editorTextLength == 0 ) { - return null; - } - - if ( (cursorOffset >= editorTextLength) || (cursorOffset > 1 && !isIdentifierPart(editorText.charAt(cursorOffset) ) && isIdentifierPart(editorText.charAt(cursorOffset - 1))) ) { - cursorOffset--; - } - - if ( isIdentifierPart(editorText.charAt(cursorOffset)) ) { - int start = cursorOffset; - int end = cursorOffset; - - while ( start > 0 && isIdentifierPart(editorText.charAt(start-1)) ) { - start--; - } - - while ( end < editorTextLength && isIdentifierPart(editorText.charAt(end)) ) { - end++; - } - - return editorText.subSequence(start, end).toString(); - } - return null; - } - - private boolean isIdentifierPart(char ch) { - return Character.isJavaIdentifierPart(ch); - } -} diff --git a/src/de/dreamlab/dash/SearchService.java b/src/de/dreamlab/dash/SearchService.java new file mode 100644 index 0000000..621f7b1 --- /dev/null +++ b/src/de/dreamlab/dash/SearchService.java @@ -0,0 +1,197 @@ +package de.dreamlab.dash; + +import com.intellij.lang.Language; +import com.intellij.lang.injection.InjectedLanguageManager; +import com.intellij.notification.Notification; +import com.intellij.notification.NotificationType; +import com.intellij.notification.Notifications; +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.editor.SelectionModel; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.openapi.wm.impl.status.StatusBarUtil; +import com.intellij.psi.PsiComment; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; +import de.dreamlab.dash.launcher.AbstractLauncher; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class SearchService { + // singleton + private static SearchService ourInstance = new SearchService(); + + public static SearchService getInstance() + { + return ourInstance; + } + + // class instance + private static final String XML_LANGUAGE_ID = "XML"; + private KeywordLookup keywordLookup; + private AbstractLauncher launcher; + + + private SearchService() { + keywordLookup = new KeywordLookup(); + launcher = AbstractLauncher.createInstance(); + } + + private @Nullable PsiElement getPsiElementAtCursor(@Nonnull Editor editor, @Nullable Project project, @Nullable PsiFile psiFile) + { + if ( psiFile == null ) { + return null; + } + + int caretOffset = editor.getCaretModel().getOffset(); + + if ( project != null ) { + InjectedLanguageManager injectedLanguageManager = InjectedLanguageManager.getInstance(project); + + if ( injectedLanguageManager != null ) { + PsiElement injectedPsiElement = injectedLanguageManager.findInjectedElementAt(psiFile, caretOffset); + + if ( injectedPsiElement != null ) { + return injectedPsiElement; + } + } + } + + return psiFile.findElementAt(editor.getCaretModel().getOffset()); + } + + private @Nullable String getSearchQueryFromEditor(@Nonnull Editor editor, @Nullable PsiElement psiElement) + { + SelectionModel selectionModel = editor.getSelectionModel(); + if ( selectionModel.hasSelection() ) { + return selectionModel.getSelectedText(); + } + + if ( psiElement == null || psiElement instanceof PsiComment ) { + return getWordAtCursor(editor); + } + + return psiElement.getText(); + } + + public void smartSearch(@Nonnull Editor editor, @Nullable Project project, @Nullable PsiFile psiFile, @Nullable VirtualFile virtualFile) + { + PsiElement psiElement = getPsiElementAtCursor(editor, project, psiFile); + Language language = elementLanguage(psiElement); + String resolvedLanguage = keywordLookup.findLanguageName(language); + + if ( resolvedLanguage == null ) { + psiElement = null; + } + + String query = getSearchQueryFromEditor(editor, psiElement); + + if ( query == null ) { + return; + } + + + // show status message for potential troubleshooting + final StringBuilder messageBuilder = new StringBuilder(); + + if ( resolvedLanguage == null ) { + messageBuilder.append("Searching all docsets in Dash"); + } + else { + messageBuilder.append(String.format("Searching \"%s\" docsets in Dash", resolvedLanguage)); + } + + if ( language != null && !language.getID().equals(resolvedLanguage) ) { + messageBuilder.append(String.format(". Based on \"%s\" context.", language.getID())); + } + + if ( project != null ) { + StatusBarUtil.setStatusBarInfo(project, messageBuilder.toString()); + } + + // open dash + launcher.search(keywordLookup.findKeywords(new LookupInfoDictionary(language, psiElement, project, psiFile, virtualFile)), query); + + /* + use the following command to display information about the sdk in use in the event log. intended for development purposes. + showSdkDebug(AbstractSdkKeyword.findSdk(psiElement, project, psiFile, virtualFile)); + */ + } + + private void showSdkDebug(@Nullable Sdk sdk) + { + StringBuilder sdkMessage = new StringBuilder(); + + if ( sdk != null ) { + sdkMessage.append(String.format("Name: %s\n", sdk.getName())); + sdkMessage.append(String.format("SdkType: %s\n", sdk.getSdkType().getName())); + sdkMessage.append(String.format("VersionString: %s\n", sdk.getVersionString())); + + } + else { + sdkMessage.append("not available"); + } + + Notifications.Bus.notify(new Notification("Dash", "Dash SDK: ", sdkMessage.toString(), NotificationType.INFORMATION)); + } + + private @Nullable Language elementLanguage(final @Nullable PsiElement element) + { + if ( element == null ) { + return null; + } + + try { + if ( XML_LANGUAGE_ID.equals(element.getLanguage().getID()) ) { + PsiElement parent = element.getParent(); + + if ( !XML_LANGUAGE_ID.equals(parent.getLanguage().getID()) && XML_LANGUAGE_ID.equals(parent.getLanguage().getBaseLanguage().getID()) ) { + return parent.getLanguage(); + } + } + + return element.getLanguage(); + } + catch ( NullPointerException e ) { + return null; + } + } + + private @Nullable String getWordAtCursor(final @Nonnull Editor editor) + { + CharSequence editorText = editor.getDocument().getCharsSequence(); + int cursorOffset = editor.getCaretModel().getOffset(); + int editorTextLength = editorText.length(); + + if ( editorTextLength == 0 ) { + return null; + } + + if ( (cursorOffset >= editorTextLength) || (cursorOffset > 1 && !isIdentifierPart(editorText.charAt(cursorOffset) ) && isIdentifierPart(editorText.charAt(cursorOffset - 1))) ) { + cursorOffset--; + } + + if ( isIdentifierPart(editorText.charAt(cursorOffset)) ) { + int start = cursorOffset; + int end = cursorOffset; + + while ( start > 0 && isIdentifierPart(editorText.charAt(start-1)) ) { + start--; + } + + while ( end < editorTextLength && isIdentifierPart(editorText.charAt(end)) ) { + end++; + } + + return editorText.subSequence(start, end).toString(); + } + return null; + } + + private boolean isIdentifierPart(final char ch) + { + return Character.isJavaIdentifierPart(ch); + } +} diff --git a/src/de/dreamlab/dash/SmartSearchAction.java b/src/de/dreamlab/dash/SmartSearchAction.java new file mode 100644 index 0000000..bee43c5 --- /dev/null +++ b/src/de/dreamlab/dash/SmartSearchAction.java @@ -0,0 +1,67 @@ +package de.dreamlab.dash; + + +import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.IconLoader; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiFile; + +import javax.swing.*; + +public class SmartSearchAction extends AnAction { + private boolean isPresentationInitialized = false; + + public SmartSearchAction() + { + } + + private void initPresentation() + { + String docAppName = ""; + + if ( SystemUtil.isIsOSMac() ) { + docAppName = " in Dash"; + } + + Presentation presentation = this.getTemplatePresentation(); + presentation.setText("Search Documentation" + docAppName); + presentation.setDescription("Searches documentation for word under caret or selected text" + docAppName); + + Icon icon = IconLoader.getIcon("/dash.png", SmartSearchAction.class); + presentation.setIcon(icon); + } + + @Override + public void update(AnActionEvent e) { + super.update(e); + + Presentation presentation = e.getPresentation(); + + if ( !isPresentationInitialized ) { + isPresentationInitialized = true; + initPresentation(); + + Presentation templatePresentation = getTemplatePresentation(); + presentation.setText(templatePresentation.getText()); + presentation.setDescription(templatePresentation.getDescription()); + presentation.setIcon(templatePresentation.getIcon()); + } + + presentation.setEnabled(PlatformDataKeys.EDITOR.getData(e.getDataContext()) != null); + } + + public void actionPerformed(AnActionEvent e) { + final Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext()); + if ( editor == null ) { + return; + } + + final Project project = e.getProject(); + final PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE); + final VirtualFile virtualFile = e.getData(LangDataKeys.VIRTUAL_FILE); + + SearchService.getInstance().smartSearch(editor, project, psiFile, virtualFile); + } +} From 43607b8681326d8f41632e0556e17559b2fa7843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sat, 16 Dec 2017 00:42:59 +0000 Subject: [PATCH 89/97] added search without filtering closes #28 --- META-INF/plugin.xml | 7 ++- src/de/dreamlab/dash/AbstractMenuAction.java | 57 ++++++++++++++++++++ src/de/dreamlab/dash/SearchAction.java | 27 ++++++++++ src/de/dreamlab/dash/SearchService.java | 14 +++++ src/de/dreamlab/dash/SmartSearchAction.java | 48 +++-------------- 5 files changed, 111 insertions(+), 42 deletions(-) create mode 100644 src/de/dreamlab/dash/AbstractMenuAction.java create mode 100644 src/de/dreamlab/dash/SearchAction.java diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index dfc01bd..286c3c3 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -87,10 +87,15 @@ - + + + + + + diff --git a/src/de/dreamlab/dash/AbstractMenuAction.java b/src/de/dreamlab/dash/AbstractMenuAction.java new file mode 100644 index 0000000..cc9d23c --- /dev/null +++ b/src/de/dreamlab/dash/AbstractMenuAction.java @@ -0,0 +1,57 @@ +package de.dreamlab.dash; + +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.PlatformDataKeys; +import com.intellij.openapi.actionSystem.Presentation; +import com.intellij.openapi.util.IconLoader; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.swing.*; + +abstract public class AbstractMenuAction extends AnAction { + protected @Nonnull String title = ""; + protected @Nonnull String description = ""; + protected @Nullable String iconFilename = null; + + + private boolean isPresentationInitialized = false; + + private void initPresentation() + { + String docAppName = ""; + + if ( SystemUtil.isIsOSMac() ) { + docAppName = " in Dash"; + } + + Presentation presentation = this.getTemplatePresentation(); + presentation.setText(title + docAppName); + presentation.setDescription(description + docAppName); + + if ( iconFilename != null ) { + Icon icon = IconLoader.getIcon("/" + iconFilename, AbstractMenuAction.class); + presentation.setIcon(icon); + } + } + + @Override + public void update(AnActionEvent e) { + super.update(e); + + Presentation presentation = e.getPresentation(); + + if ( !isPresentationInitialized ) { + isPresentationInitialized = true; + initPresentation(); + + Presentation templatePresentation = getTemplatePresentation(); + presentation.setText(templatePresentation.getText()); + presentation.setDescription(templatePresentation.getDescription()); + presentation.setIcon(templatePresentation.getIcon()); + } + + presentation.setEnabled(PlatformDataKeys.EDITOR.getData(e.getDataContext()) != null); + } +} diff --git a/src/de/dreamlab/dash/SearchAction.java b/src/de/dreamlab/dash/SearchAction.java new file mode 100644 index 0000000..1bb8f46 --- /dev/null +++ b/src/de/dreamlab/dash/SearchAction.java @@ -0,0 +1,27 @@ +package de.dreamlab.dash; + +import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.project.Project; +import com.intellij.psi.PsiFile; + + +public class SearchAction extends AbstractMenuAction { + public SearchAction() + { + title = "Search all Documentation"; + description = "Searches word under caret or selection in documentation"; + } + + public void actionPerformed(AnActionEvent e) { + final Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext()); + if ( editor == null ) { + return; + } + + final Project project = e.getProject(); + final PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE); + + SearchService.getInstance().search(editor, project, psiFile); + } +} diff --git a/src/de/dreamlab/dash/SearchService.java b/src/de/dreamlab/dash/SearchService.java index 621f7b1..ec4e201 100644 --- a/src/de/dreamlab/dash/SearchService.java +++ b/src/de/dreamlab/dash/SearchService.java @@ -18,6 +18,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.util.ArrayList; public class SearchService { // singleton @@ -76,6 +77,19 @@ private SearchService() { return psiElement.getText(); } + public void search(@Nonnull Editor editor, @Nullable Project project, @Nullable PsiFile psiFile) + { + PsiElement psiElement = getPsiElementAtCursor(editor, project, psiFile); + String query = getSearchQueryFromEditor(editor, psiElement); + + if ( query == null ) { + return; + } + + // open dash + launcher.search(new ArrayList<>(), query); + } + public void smartSearch(@Nonnull Editor editor, @Nullable Project project, @Nullable PsiFile psiFile, @Nullable VirtualFile virtualFile) { PsiElement psiElement = getPsiElementAtCursor(editor, project, psiFile); diff --git a/src/de/dreamlab/dash/SmartSearchAction.java b/src/de/dreamlab/dash/SmartSearchAction.java index bee43c5..16b4887 100644 --- a/src/de/dreamlab/dash/SmartSearchAction.java +++ b/src/de/dreamlab/dash/SmartSearchAction.java @@ -1,55 +1,21 @@ package de.dreamlab.dash; -import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.LangDataKeys; +import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiFile; -import javax.swing.*; - -public class SmartSearchAction extends AnAction { - private boolean isPresentationInitialized = false; +public class SmartSearchAction extends AbstractMenuAction { public SmartSearchAction() { - } - - private void initPresentation() - { - String docAppName = ""; - - if ( SystemUtil.isIsOSMac() ) { - docAppName = " in Dash"; - } - - Presentation presentation = this.getTemplatePresentation(); - presentation.setText("Search Documentation" + docAppName); - presentation.setDescription("Searches documentation for word under caret or selected text" + docAppName); - - Icon icon = IconLoader.getIcon("/dash.png", SmartSearchAction.class); - presentation.setIcon(icon); - } - - @Override - public void update(AnActionEvent e) { - super.update(e); - - Presentation presentation = e.getPresentation(); - - if ( !isPresentationInitialized ) { - isPresentationInitialized = true; - initPresentation(); - - Presentation templatePresentation = getTemplatePresentation(); - presentation.setText(templatePresentation.getText()); - presentation.setDescription(templatePresentation.getDescription()); - presentation.setIcon(templatePresentation.getIcon()); - } - - presentation.setEnabled(PlatformDataKeys.EDITOR.getData(e.getDataContext()) != null); + title = "Smart Search Documentation"; + description = "Searches word under caret or selection in documentation filtered by currently used language"; + iconFilename = "dash.png"; } public void actionPerformed(AnActionEvent e) { From 6f4c5e86abd4a929a0869615983c664df8f7b677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sat, 16 Dec 2017 00:47:44 +0000 Subject: [PATCH 90/97] java 9 sdk detection & mapping --- src/de/dreamlab/dash/KeywordLookup.java | 2 +- .../dash/keywords/JavaSdkVersionDependentKeyword.java | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 7058c3e..a72f7c0 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -41,7 +41,7 @@ public KeywordLookup() setLanguage("SQLite", "sqlite"); // not WebStorm // Products listed for each entry - final IKeyword javaVersionedKeyword = new JavaSdkVersionDependentKeyword("java6", "java7", "java8"); + final IKeyword javaVersionedKeyword = new JavaSdkVersionDependentKeyword("java6", "java7", "java8", "java9"); final IKeyword javaKeyword = new SdkTypeSpecificKeyword("java", "Android SDK", "android"); final IKeyword javaFxKeyword = new ExcludeSdkTypeKeyword("javafx", "Android SDK"); final IKeyword grailsKeyword = new ExcludeSdkTypeKeyword("grails", "Android SDK"); diff --git a/src/de/dreamlab/dash/keywords/JavaSdkVersionDependentKeyword.java b/src/de/dreamlab/dash/keywords/JavaSdkVersionDependentKeyword.java index cc616c6..0fe1277 100644 --- a/src/de/dreamlab/dash/keywords/JavaSdkVersionDependentKeyword.java +++ b/src/de/dreamlab/dash/keywords/JavaSdkVersionDependentKeyword.java @@ -7,11 +7,13 @@ public class JavaSdkVersionDependentKeyword extends AbstractSdkKeyword implement private String java6Keyword; private String java7Keyword; private String java8Keyword; + private String java9Keyword; - public JavaSdkVersionDependentKeyword(String java6Keyword, String java7Keyword, String java8Keyword) { + public JavaSdkVersionDependentKeyword(String java6Keyword, String java7Keyword, String java8Keyword, String java9Keyword) { this.java6Keyword = java6Keyword; this.java7Keyword = java7Keyword; this.java8Keyword = java8Keyword; + this.java9Keyword = java9Keyword; } @Override @@ -31,6 +33,9 @@ else if ( versionString.contains("1.7.") ) { else if ( versionString.contains("1.8.") ) { return java8Keyword; } + else if ( versionString.contains("1.9.") ) { + return java9Keyword; + } } } From f9109e6064d39f72dcf341d30ae340d368b72181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sat, 16 Dec 2017 01:04:49 +0000 Subject: [PATCH 91/97] =?UTF-8?q?updated=20info=20text=20for=20=E2=80=9ESe?= =?UTF-8?q?arch=20all=E2=80=9C=20feature?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #28 --- META-INF/plugin.xml | 10 +++++----- README.md | 8 ++++---- src/de/dreamlab/dash/SmartSearchAction.java | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 286c3c3..d171247 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -8,15 +8,15 @@

A smart and simple plugin that provides keyboard shortcut access for Dash, Velocity or Zeal in IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm, DataGrip, CLion, GoLand and Android Studio.

Usage

-

The default shortcut assigned to search is Cmd-Shift-D (Mac OS X) or Ctrl-Shift-D (Windows, Linux).

-

A menubar command named either "Search Documentation" can be found in the "Tools" menu.

-

The plugin either searches for the statement at caret position or the current selection. It will identify the programming language in use and request filtered results accordingly.

+

The default shortcut assigned to smart-search is Cmd-Shift-D (Mac OS X) or Ctrl-Shift-D (Windows, Linux).

+

A menubar command named either "Smart-Search Documentation" can be found in the "Tools" menu.

+

The plugin either searches for the statement at caret position or the current selection. It will identify the programming language in use and request filtered results accordingly. A non filtered search over all documentation entries can be invoked by adding the Alt modifier key to the shortcut. "Search all Documentation" is also available in the tools menu.

Configuration

Shortcut

You can change the shortcut at Preferences -> Keymap -> Plug-ins -> Dash.

Toolbar Icon

-

You can add a "Search Documentation" button to the toolbar. Right-click the menubar -> Customize […]. You will find the button under "Plug-ins -> Dash".

+

You can add a button to the toolbar. Right-click the menubar -> Customize […]. You will find the button under "Plug-ins -> Dash".

Supported API Documentation Browsers

Kapeli Dash (Mac OS X)

@@ -87,7 +87,7 @@ - + diff --git a/README.md b/README.md index 55bb1db..a0f82f0 100644 --- a/README.md +++ b/README.md @@ -4,20 +4,20 @@ A smart and simple plugin that provides keyboard shortcut access for Dash, Veloc To install the plugin in your IDE go to **Preferences -> Plugins -> Browse repositories** and **search for "Dash"**. ## Usage -The default **shortcut** assigned to search is **Cmd-Shift-D** (Mac OS X) or **Ctrl-Shift-D** (Windows, Linux). +The default **shortcut** assigned to smart-search is **Cmd-Shift-D** (Mac OS X) or **Ctrl-Shift-D** (Windows, Linux). -A **menubar command** named "**Search Documentation**" can be found in the "Tools" menu. +A **menubar command** named "**Smart-Search Documentation**" can be found in the "Tools" menu. -The plugin either searches for the statement at caret position or the current selection. It will identify the programming language in use and request filtered results accordingly. +The plugin either searches for the statement at caret position or the current selection. It will identify the programming language in use and request filtered results accordingly. A non filtered search over all documentation entries can be invoked by adding the **Alt** modifier key to the shortcut. "**Search all Documentation**" is also available in the tools menu. ## Configuration ### Shortcut You can change the shortcut at Preferences -> Keymap -> Plug-ins -> Dash. ### Toolbar Icon -You can add a "Search Documentation" button to the toolbar. Right-click the menubar -> Customize […]. You will find the button under "Plug-ins -> Dash". +You can add a button to the toolbar. Right-click the menubar -> Customize […]. You will find the button under "Plug-ins -> Dash". ## Supported API Documentation Browsers ### Kapeli Dash (Mac OS X) diff --git a/src/de/dreamlab/dash/SmartSearchAction.java b/src/de/dreamlab/dash/SmartSearchAction.java index 16b4887..51e3a53 100644 --- a/src/de/dreamlab/dash/SmartSearchAction.java +++ b/src/de/dreamlab/dash/SmartSearchAction.java @@ -13,7 +13,7 @@ public class SmartSearchAction extends AbstractMenuAction { public SmartSearchAction() { - title = "Smart Search Documentation"; + title = "Smart-Search Documentation"; description = "Searches word under caret or selection in documentation filtered by currently used language"; iconFilename = "dash.png"; } From 43824beac776e363f5107a87b5482a21e265702b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sat, 16 Dec 2017 01:07:49 +0000 Subject: [PATCH 92/97] updated version --- META-INF/plugin.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index d171247..4a433a5 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,7 +1,7 @@ com.paperetto.dash Dash - 3.2.5 + 3.3 Gerard Delmàs +3.3 + - Added non-smart "Search all Documentation" option + - Java 9 SDK detection 3.2.5 - Fixed Zeal Support - Go, Elixir & Erlang support From 85f1eb9790d9258aef29bac14430b17fe985e8da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sat, 16 Dec 2017 01:27:30 +0000 Subject: [PATCH 93/97] =?UTF-8?q?status=20message=20for=20=E2=80=9Esearch?= =?UTF-8?q?=20all=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/de/dreamlab/dash/SearchService.java | 32 +++++++++++++++---------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/de/dreamlab/dash/SearchService.java b/src/de/dreamlab/dash/SearchService.java index ec4e201..407804d 100644 --- a/src/de/dreamlab/dash/SearchService.java +++ b/src/de/dreamlab/dash/SearchService.java @@ -87,6 +87,7 @@ public void search(@Nonnull Editor editor, @Nullable Project project, @Nullable } // open dash + showStatusMessage(project, null, null); launcher.search(new ArrayList<>(), query); } @@ -106,32 +107,37 @@ public void smartSearch(@Nonnull Editor editor, @Nullable Project project, @Null return; } + // open dash + showStatusMessage(project, resolvedLanguage, language); + launcher.search(keywordLookup.findKeywords(new LookupInfoDictionary(language, psiElement, project, psiFile, virtualFile)), query); + + /* + use the following command to display information about the sdk in use in the event log. intended for development purposes. + showSdkDebug(AbstractSdkKeyword.findSdk(psiElement, project, psiFile, virtualFile)); + */ + } + + private void showStatusMessage(final @Nullable Project project, final @Nullable String resolvedLanguage, final @Nullable Language language) + { + if ( project == null ) { + return; + } // show status message for potential troubleshooting final StringBuilder messageBuilder = new StringBuilder(); if ( resolvedLanguage == null ) { - messageBuilder.append("Searching all docsets in Dash"); + messageBuilder.append("Searching all documentation"); } else { - messageBuilder.append(String.format("Searching \"%s\" docsets in Dash", resolvedLanguage)); + messageBuilder.append(String.format("Smart-Searching \"%s\" documentation", resolvedLanguage)); } if ( language != null && !language.getID().equals(resolvedLanguage) ) { messageBuilder.append(String.format(". Based on \"%s\" context.", language.getID())); } - if ( project != null ) { - StatusBarUtil.setStatusBarInfo(project, messageBuilder.toString()); - } - - // open dash - launcher.search(keywordLookup.findKeywords(new LookupInfoDictionary(language, psiElement, project, psiFile, virtualFile)), query); - - /* - use the following command to display information about the sdk in use in the event log. intended for development purposes. - showSdkDebug(AbstractSdkKeyword.findSdk(psiElement, project, psiFile, virtualFile)); - */ + StatusBarUtil.setStatusBarInfo(project, messageBuilder.toString()); } private void showSdkDebug(@Nullable Sdk sdk) From cc74ad013c023c1f04491888d17bdc963294c032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Tue, 16 Jan 2018 19:36:04 +0100 Subject: [PATCH 94/97] updated license --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index 3ea19d6..d3e20db 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2016 Gerard Delmàs +Copyright (c) 2013-2018 Gerard Delmàs and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: From 6f5619d0ea9a0326404c78d900289f7a378f19ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delm=C3=A0s?= Date: Sat, 20 Jan 2018 01:03:14 +0100 Subject: [PATCH 95/97] Readme: Zeal/Windows troubleshooting entry thanks to #70 --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index a0f82f0..1c8ea06 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,9 @@ Zeal is a simple offline API documentation browser inspired by Dash (OS X app). ## Troubleshooting +###### On Windows, when using Zeal the IDE shows `Failed to open dash-plugin://...` in the Event Log +It looks like the URL handler has not been registered for Zeal. Please run `zeal.exe --register`. + ###### The plugin does not work on old IDEs Older IDE versions like **AppCode 1.x** are not supported anymore. Please manually install version 2.2 of the plugin: https://github.com/gdelmas/IntelliJDashPlugin/releases/tag/2.2 From 954a1d94c898cc4cc5e86e1238315b35f9f2d6a6 Mon Sep 17 00:00:00 2001 From: jafa7250 <39117241+jafa7250@users.noreply.github.com> Date: Mon, 25 Jun 2018 18:04:57 +0200 Subject: [PATCH 96/97] Add correct angular keyword for Zeal --- src/de/dreamlab/dash/KeywordLookup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index a72f7c0..8a746bd 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -33,7 +33,7 @@ public KeywordLookup() setLanguage("CoffeeScript", "coffee", "javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap"); // not IntelliJ setLanguage("JavaScript", (Object[])FileTypeSpecificKeyword.createList( - new String[]{"javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap", "angularjs", "angularts"}, + new String[]{"javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "titanium", "knockout", "zepto", "yui", "d3", "dojo", "nodejs", "express", "grunt", "mongoose", "moment", "require", "awsjs", "jasmine", "sinon", "chai", "cordova", "phonegap", "angularjs", "angularts", "angular"}, "ActionScript", new String[]{"actionscript"}) ); From 6161e06c5d9ff93982dc6a98fbf472380acbc000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Thu, 28 Feb 2019 23:05:15 +0000 Subject: [PATCH 97/97] added dartdocs mapping #77 --- src/de/dreamlab/dash/KeywordLookup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/dreamlab/dash/KeywordLookup.java b/src/de/dreamlab/dash/KeywordLookup.java index 8a746bd..172f60d 100644 --- a/src/de/dreamlab/dash/KeywordLookup.java +++ b/src/de/dreamlab/dash/KeywordLookup.java @@ -49,7 +49,7 @@ public KeywordLookup() final IKeyword playjavaKeyword = new ExcludeSdkTypeKeyword("playjava", "Android SDK"); final IKeyword springKeyword = new ExcludeSdkTypeKeyword("spring", "Android SDK"); - setLanguage("Dart", "dartlang", "polymerdart", "angulardart"); // WebStorm + setLanguage("Dart", "dartlang", "dartdocs", "polymerdart", "angulardart"); // WebStorm setLanguage("DjangoTemplate", "django"); // PyCharm setLanguage("Groovy", "groovy"); // IntelliJ setLanguage("Jade", "jade"); // WebStorm