From 5bfc892a74497d7a83da3af20cf2791b7146ee3a Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Tue, 16 Jun 2020 06:49:07 +0200 Subject: [PATCH] Add support for dozens more languages to the comment plugin (#1729) --- runtime/plugins/comment/comment.lua | 50 ++++++++++++++++++++----- runtime/plugins/comment/help/comment.md | 36 +++++++++++++++++- 2 files changed, 76 insertions(+), 10 deletions(-) diff --git a/runtime/plugins/comment/comment.lua b/runtime/plugins/comment/comment.lua index b51c9e1c..68bbc01c 100644 --- a/runtime/plugins/comment/comment.lua +++ b/runtime/plugins/comment/comment.lua @@ -6,26 +6,58 @@ local buffer = import("micro/buffer") local ft = {} +ft["apacheconf"] = "# %s" +ft["bat"] = ":: %s" ft["c"] = "// %s" ft["c++"] = "// %s" +ft["cmake"] = "# %s" +ft["conf"] = "# %s" +ft["crystal"] = "# %s" +ft["css"] = "/* %s */" +ft["d"] = "// %s" +ft["dart"] = "// %s" +ft["dockerfile"] = "# %s" +ft["elm"] = "-- %s" +ft["fish"] = "# %s" +ft["gdscript"] = "# %s" +ft["glsl"] = "// %s" ft["go"] = "// %s" -ft["python"] = "# %s" -ft["python3"] = "# %s" +ft["haskell"] = "-- %s" ft["html"] = "" +ft["ini"] = "; %s" ft["java"] = "// %s" +ft["javascript"] = "// %s" +ft["jinja2"] = "{# %s #}" ft["julia"] = "# %s" +ft["kotlin"] = "// %s" +ft["lua"] = "-- %s" +ft["markdown"] = "" +ft["nginx"] = "# %s" +ft["nim"] = "# %s" +ft["objc"] = "// %s" +ft["pascal"] = "{ %s }" ft["perl"] = "# %s" ft["php"] = "// %s" -ft["rust"] = "// %s" -ft["shell"] = "# %s" -ft["lua"] = "-- %s" -ft["haskell"] = "-- %s" -ft["javascript"] = "// %s" +ft["pony"] = "// %s" +ft["powershell"] = "# %s" +ft["proto"] = "// %s" +ft["python"] = "# %s" +ft["python3"] = "# %s" ft["ruby"] = "# %s" -ft["d"] = "// %s" +ft["rust"] = "// %s" +ft["scala"] = "// %s" +ft["shell"] = "# %s" +ft["sql"] = "-- %s" ft["swift"] = "// %s" -ft["elm"] = "-- %s" ft["tex"] = "% %s" +ft["toml"] = "# %s" +ft["twig"] = "{# %s #}" +ft["v"] = "// %s" +ft["xml"] = "" +ft["yaml"] = "# %s" +ft["zig"] = "// %s" +ft["zscript"] = "// %s" +ft["zsh"] = "# %s" function onBufferOpen(buf) if buf.Settings["commenttype"] == nil then diff --git a/runtime/plugins/comment/help/comment.md b/runtime/plugins/comment/help/comment.md index 22e3769d..63f046a7 100644 --- a/runtime/plugins/comment/help/comment.md +++ b/runtime/plugins/comment/help/comment.md @@ -23,23 +23,58 @@ selected. The comment type will be auto detected based on the filetype, but it is only available for certain filetypes: +* apacheconf: `# %s` +* bat: `:: %s` * c: `// %s` * c++: `// %s` +* cmake: `# %s` +* conf: `# %s` +* crystal: `# %s` +* css: `/* %s */` * d: `// %s` +* dart: `// %s` +* dockerfile: `# %s` +* elm: `-- %s` +* fish: `# %s` +* gdscript: `# %s` +* glsl: `// %s` * go: `// %s` +* haskell: `-- %s` * html: `` +* ini: `; %s` * java: `// %s` * javascript: `// %s` +* jinja2: `{# %s #}` * julia: `# %s` +* kotlin: `// %s` * lua: `-- %s` +* markdown: `` +* nginx: `# %s` +* nim: `# %s` +* objc: `// %s` +* pascal: `{ %s }` * perl: `# %s` * php: `// %s` +* pony: `// %s` +* powershell: `# %s` +* proto: `// %s` * python: `# %s` * python3: `# %s` * ruby: `# %s` * rust: `// %s` +* scala: `// %s` * shell: `# %s` +* sql: `-- %s` * swift: `// %s` +* tex: `% %s` +* toml: `# %s` +* twig: `{# %s #}` +* v: `// %s` +* xml: `` +* yaml: `# %s` +* zig: `// %s` +* zscript: `// %s` +* zsh: `# %s` If your filetype is not available here, you can simply modify the `commenttype` option: @@ -57,4 +92,3 @@ Or in your `settings.json`: } } ``` -