mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 08:07:49 +00:00
feat(templates): New Go Module template for go.mod files (#884)
New ▸ Go Module creates go.mod with `module $PROJECT_NAME$` and a `go 1.20` directive. The go.mod language, icon and gopls were already registered; only the file template was missing. It also appears in Search Everywhere and Settings ▸ File and Code Templates. Fixes #882 Co-authored-by: a-rookie-of-C-language <186315048+a-rookie-of-C-language@users.noreply.github.com>
This commit is contained in:
co-authored by
a-rookie-of-C-language
parent
edfe6c7b65
commit
ece2b2a59e
@@ -70,15 +70,17 @@ describe("file naming", () => {
|
||||
expect(withKind(css, kind("css"))).toBe(css);
|
||||
});
|
||||
|
||||
it("prefills fixed names (Dockerfile, .editorconfig, .gitignore)", () => {
|
||||
it("prefills fixed names (Dockerfile, .editorconfig, .gitignore, go.mod)", () => {
|
||||
for (const [id, name] of [
|
||||
["dockerfile", "Dockerfile"],
|
||||
["editorconfig", ".editorconfig"],
|
||||
["gitignore", ".gitignore"],
|
||||
["go-mod", "go"],
|
||||
] as const) {
|
||||
const t = tpl(id);
|
||||
expect(t.defaultName).toBe(name);
|
||||
expect(planFile(t, "/p", t.defaultName!)?.path).toBe(`/p/${name}`);
|
||||
const ext = t.extension ? `.${t.extension}` : "";
|
||||
expect(planFile(t, "/p", t.defaultName!)?.path).toBe(`/p/${name}${ext}`);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -140,6 +140,15 @@ export const BUILTIN_FILE_TEMPLATES: readonly FileTemplate[] = [
|
||||
{ id: "main", label: "Main", body: "package main\n\nfunc main() {\n\t$END$\n}\n" },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "go-mod",
|
||||
name: "Go Module",
|
||||
icon: "file-gomod",
|
||||
extension: "mod",
|
||||
nameStyle: "asis",
|
||||
defaultName: "go",
|
||||
kinds: [{ id: "module", label: "Module", body: "module $PROJECT_NAME$\n\ngo 1.20\n" }],
|
||||
},
|
||||
{
|
||||
id: "java",
|
||||
name: "Java Class",
|
||||
|
||||
Reference in New Issue
Block a user