Browse Source

release 0.2.1
add markdown support for workspace documentation rendering in hover tip

Geequlim 8 years ago
parent
commit
6c4fca265a
5 changed files with 23 additions and 6 deletions
  1. 5 1
      CHANGELOG.md
  2. 6 2
      README.md
  3. 6 1
      package.json
  4. 4 0
      src/gdscript/hoverprovider.ts
  5. 2 2
      src/gdscript/symbolparser.ts

+ 5 - 1
CHANGELOG.md

@@ -1,5 +1,9 @@
 # Change Log
 
+### 0.2.1
+* Support markdown render in hover tips for documentations in workspace symbols
+* Add configuration `GodotTools.workspaceDocumentWithMarkdown` to control workspace documentation rendering
+
 ### 0.2.0
 
 * Show autoloads informations in hover tips and go to autoloads' definitions are supported now
@@ -54,4 +58,4 @@
 * Better syntax highlight with GDScript
 
 ### 0.1.0
-* Initial release
+* Initial release

+ 6 - 2
README.md

@@ -30,7 +30,7 @@ You can use the following settings to setup the Godot Tools:
 - GodotTools.editorServerPort: The http server port used by the EditorServer Godot module (_see Extra Functionality below_)
 - GodotTools.maxNumberOfProblems: Sets the limit for the issues reported by the static code validator
 - GodotTools.editorPath: An absolute path pointing at the Godot Editor executable file. Required to run the project and test scenes from VScode
-
+- GodotTools.workspaceDocumentWithMarkdown: Control the documentations of workspace symbols should be rendered as plain text or html from markdown
 
 ## Extra functionality
 
@@ -53,6 +53,10 @@ The [Godot Tools](https://github.com/GodotExplorer/godot-tools) and the go to [e
 
 ## Release Notes
 
+### 0.2.1
+* Support markdown render in hover tips for documentations in workspace symbols
+* Add configuration `GodotTools.workspaceDocumentWithMarkdown` to control workspace documentation rendering
+
 ### 0.2.0
 
 * Show autoloads informations in hover tips and go to autoloads' definitions are supported now
@@ -71,4 +75,4 @@ The [Godot Tools](https://github.com/GodotExplorer/godot-tools) and the go to [e
 * More reliable unused variable and constant checking in documente
 * Show workspace documentations and function signatures in completions
 
-[Read more from the full change log](https://github.com/GodotExplorer/godot-tools/blob/master/CHANGELOG.md)
+[Read more from the full change log](https://github.com/GodotExplorer/godot-tools/blob/master/CHANGELOG.md)

+ 6 - 1
package.json

@@ -3,7 +3,7 @@
   "displayName": "Godot Tools",
   "icon": "icon.png",
   "description": "\"Tools for game development with godot game engine\"",
-  "version": "0.2.0",
+  "version": "0.2.1",
   "publisher": "geequlim",
   "engines": {
     "vscode": "^1.5.0"
@@ -53,6 +53,11 @@
           "type": "string",
           "default": "",
           "description": "The absolute path of your godot editor"
+        },
+        "GodotTools.workspaceDocumentWithMarkdown": {
+          "type": "boolean",
+          "default": false,
+          "description": "Render workspace documentations as markdown content"
         }
       }
     },

+ 4 - 0
src/gdscript/hoverprovider.ts

@@ -33,6 +33,8 @@ class GDScriptHoverProvider implements HoverProvider {
             hoverText = getStrContent(hoverText);
         const workspaceSymbols = config.getAllSymbols();
         let tips: MarkedString[] = [];
+        const withMarkdwon = workspace.getConfiguration("GodotTools").get("workspaceDocumentWithMarkdown", false);
+
         // check from workspace
         const genWorkspaceTips = ()=> {
             for (let path of Object.keys(workspaceSymbols)) {
@@ -52,6 +54,8 @@ class GDScriptHoverProvider implements HoverProvider {
                                 signature = ` = ${script.constvalues[name]}`;
                             _items.push({language:'gdscript', value:`${type} ${name}${signature}`});
                             let doc = script.documents[name];
+                            if(!withMarkdwon)
+                                doc = "```plaintext\r\n"+doc+"\r\n```";
                             doc = doc?doc+"\r\n\r\n":"";
                             if(path != "autoload")
                                 doc += `*Defined in [${dfile}](${Uri.file(path).toString()})*`;

+ 2 - 2
src/gdscript/symbolparser.ts

@@ -95,7 +95,7 @@ class GDScriptSymbolParser {
         if(commentAtEnd && line != range.start.line)
           break;
         if(match)
-          mdoc = match[1] + "\r\n\r\n" + mdoc;
+          mdoc = match[1] + "\r\n" + mdoc;
         else if(line != range.start.line)
           break
         --line;
@@ -170,4 +170,4 @@ class GDScriptSymbolParser {
 
 }
 
-export default GDScriptSymbolParser;
+export default GDScriptSymbolParser;