Skip to content

Commit

Permalink
fix: use go/doc/comment as markdown generator
Browse files Browse the repository at this point in the history
  • Loading branch information
x1unix committed Aug 8, 2024
1 parent b7c7fd4 commit 891e794
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 113 deletions.
54 changes: 27 additions & 27 deletions internal/builtin/builtin_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// See: /tools/codegen-builtins
//
// Source: ../../tools/gendata/builtin.go.txt
// Skipped: IntegerType,FloatType,ComplexType,Type,Type1
// Skipped: ComplexType,Type,Type1,IntegerType,FloatType

package builtin

Expand All @@ -14,7 +14,7 @@ var buckets = map[rune][]protocol.CompletionItem{
Detail: "func delete(m map[Type]Type1, key Type)",
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "The delete built-in function deletes the element with the specified key\n(m[key]) from the map. If m is nil or there is no such element, delete\nis a no-op.",
Value: "The delete built-in function deletes the element with the specified key (m\\[key]) from the map. If m is nil or there is no such element, delete is a no-op.",
},
InsertText: "delete()",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -25,7 +25,7 @@ var buckets = map[rune][]protocol.CompletionItem{
Detail: "type error interface {\n\tError() string\n}",
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "The error built-in interface type is the conventional interface for\nrepresenting an error condition, with the nil value representing no error.",
Value: "The error built-in interface type is the conventional interface for representing an error condition, with the nil value representing no error.",
},
InsertText: "error",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand Down Expand Up @@ -59,7 +59,7 @@ var buckets = map[rune][]protocol.CompletionItem{
int32(105): []protocol.CompletionItem{protocol.CompletionItem{
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "int8 is the set of all signed 8-bit integers.\nRange: -128 through 127.",
Value: "int8 is the set of all signed 8-bit integers. Range: -128 through 127.",
},
InsertText: "int8",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -68,7 +68,7 @@ var buckets = map[rune][]protocol.CompletionItem{
}, protocol.CompletionItem{
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "int16 is the set of all signed 16-bit integers.\nRange: -32768 through 32767.",
Value: "int16 is the set of all signed 16-bit integers. Range: -32768 through 32767.",
},
InsertText: "int16",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -77,7 +77,7 @@ var buckets = map[rune][]protocol.CompletionItem{
}, protocol.CompletionItem{
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "int32 is the set of all signed 32-bit integers.\nRange: -2147483648 through 2147483647.",
Value: "int32 is the set of all signed 32-bit integers. Range: -2147483648 through 2147483647.",
},
InsertText: "int32",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -86,7 +86,7 @@ var buckets = map[rune][]protocol.CompletionItem{
}, protocol.CompletionItem{
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "int64 is the set of all signed 64-bit integers.\nRange: -9223372036854775808 through 9223372036854775807.",
Value: "int64 is the set of all signed 64-bit integers. Range: -9223372036854775808 through 9223372036854775807.",
},
InsertText: "int64",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -95,7 +95,7 @@ var buckets = map[rune][]protocol.CompletionItem{
}, protocol.CompletionItem{
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "int is a signed integer type that is at least 32 bits in size. It is a\ndistinct type, however, and not an alias for, say, int32.",
Value: "int is a signed integer type that is at least 32 bits in size. It is a distinct type, however, and not an alias for, say, int32.",
},
InsertText: "int",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -112,7 +112,7 @@ var buckets = map[rune][]protocol.CompletionItem{
Detail: "func len(v Type) int",
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "The len built-in function returns the length of v, according to its type:\n\n```\n\tArray: the number of elements in v.\n\tPointer to array: the number of elements in *v (even if v is nil).\n\tSlice, or map: the number of elements in v; if v is nil, len(v) is zero.\n\tString: the number of bytes in v.\n\n```\nFor some arguments, such as a string literal or a simple array expression, the\nresult can be a constant.",
Value: "The len built-in function returns the length of v, according to its type:\n\n\tArray: the number of elements in v.\n\tPointer to array: the number of elements in *v (even if v is nil).\n\tSlice, or map: the number of elements in v; if v is nil, len(v) is zero.\n\tString: the number of bytes in v.\n\nFor some arguments, such as a string literal or a simple array expression, the result can be a constant.",
},
InsertText: "len()",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -123,7 +123,7 @@ var buckets = map[rune][]protocol.CompletionItem{
Detail: "func make(t Type, size ...IntegerType) Type",
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "The make built-in function allocates and initializes an object of type\nslice, map, or chan (only). Like new, the first argument is a type, not a\nvalue. Unlike new, make's return type is the same as the type of its\nargument, not a pointer to it. The specification of the result depends on\nthe type:\n\n```\n\tSlice: The size specifies the length. The capacity of the slice is\n\tequal to its length. A second integer argument may be provided to\n\tspecify a different capacity; it must be no smaller than the\n\tlength. For example, make([]int, 0, 10) allocates an underlying array\n\tof size 10 and returns a slice of length 0 and capacity 10 that is\n\tbacked by this underlying array.\n\tMap: An empty map is allocated with enough space to hold the\n\tspecified number of elements. The size may be omitted, in which case\n\ta small starting size is allocated.\n```",
Value: "The make built-in function allocates and initializes an object of type slice, map, or chan (only). Like new, the first argument is a type, not a value. Unlike new, make's return type is the same as the type of its argument, not a pointer to it. The specification of the result depends on the type:\n\n\tSlice: The size specifies the length. The capacity of the slice is\n\tequal to its length. A second integer argument may be provided to\n\tspecify a different capacity; it must be no smaller than the\n\tlength. For example, make([]int, 0, 10) allocates an underlying array\n\tof size 10 and returns a slice of length 0 and capacity 10 that is\n\tbacked by this underlying array.\n\tMap: An empty map is allocated with enough space to hold the\n\tspecified number of elements. The size may be omitted, in which case\n\ta small starting size is allocated.",
},
InsertText: "make()",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -134,7 +134,7 @@ var buckets = map[rune][]protocol.CompletionItem{
Detail: "func new(Type) *Type",
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "The new built-in function allocates memory. The first argument is a type,\nnot a value, and the value returned is a pointer to a newly\nallocated zero value of that type.",
Value: "The new built-in function allocates memory. The first argument is a type, not a value, and the value returned is a pointer to a newly allocated zero value of that type.",
},
InsertText: "new()",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -151,7 +151,7 @@ var buckets = map[rune][]protocol.CompletionItem{
Detail: "func panic(v interface{})",
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "The panic built-in function stops normal execution of the program.\nAny functions whose execution was deferred by F are run in\nthe usual way, and then F returns to its caller.\n\nAt that point, the program is terminated with a non-zero exit code. This\ntermination sequence is called panicking and can be controlled by the\nbuilt-in function recover.",
Value: "The panic built-in function stops normal execution of the program. Any functions whose execution was deferred by F are run in the usual way, and then F returns to its caller.\n\nAt that point, the program is terminated with a non-zero exit code. This termination sequence is called panicking and can be controlled by the built-in function recover.",
},
InsertText: "panic()",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -161,7 +161,7 @@ var buckets = map[rune][]protocol.CompletionItem{
Detail: "func print(args ...Type)",
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "The print built-in function formats its arguments in an\nimplementation-specific way and writes the result to standard error.\nPrint is useful for bootstrapping and debugging; it is not guaranteed\nto stay in the language.",
Value: "The print built-in function formats its arguments in an implementation-specific way and writes the result to standard error. Print is useful for bootstrapping and debugging; it is not guaranteed to stay in the language.",
},
InsertText: "print()",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -171,7 +171,7 @@ var buckets = map[rune][]protocol.CompletionItem{
Detail: "func println(args ...Type)",
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "The println built-in function formats its arguments in an\nimplementation-specific way and writes the result to standard error.\nSpaces are always added between arguments and a newline is appended.\nPrintln is useful for bootstrapping and debugging; it is not guaranteed\nto stay in the language.",
Value: "The println built-in function formats its arguments in an implementation-specific way and writes the result to standard error. Spaces are always added between arguments and a newline is appended. Println is useful for bootstrapping and debugging; it is not guaranteed to stay in the language.",
},
InsertText: "println()",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -182,7 +182,7 @@ var buckets = map[rune][]protocol.CompletionItem{
Detail: "func recover() interface{}",
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "The recover built-in function allows a program to manage behavior of a\npanicking goroutine. Executing a call to recover inside a deferred\nfunction (but not any function called by it) stops the panicking sequence\nby restoring normal execution and retrieves the error value passed to the\ncall of panic. If recover is called outside the deferred function it will\nnot stop a panicking sequence. In this case, or when the program is not\npanicking, recover returns nil.",
Value: "The recover built-in function allows a program to manage behavior of a panicking goroutine. Executing a call to recover inside a deferred function (but not any function called by it) stops the panicking sequence by restoring normal execution and retrieves the error value passed to the call of panic. If recover is called outside the deferred function it will not stop a panicking sequence. In this case, or when the program is not panicking, recover returns nil.",
},
InsertText: "recover()",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -191,7 +191,7 @@ var buckets = map[rune][]protocol.CompletionItem{
}, protocol.CompletionItem{
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "rune is an alias for int32 and is equivalent to int32 in all ways. It is\nused, by convention, to distinguish character values from integer values.",
Value: "rune is an alias for int32 and is equivalent to int32 in all ways. It is used, by convention, to distinguish character values from integer values.",
},
InsertText: "rune",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -201,7 +201,7 @@ var buckets = map[rune][]protocol.CompletionItem{
int32(115): []protocol.CompletionItem{protocol.CompletionItem{
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "string is the set of all strings of 8-bit bytes, conventionally but not\nnecessarily representing UTF-8-encoded text. A string may be empty, but\nnot nil. Values of string type are immutable.",
Value: "string is the set of all strings of 8-bit bytes, conventionally but not necessarily representing UTF-8-encoded text. A string may be empty, but not nil. Values of string type are immutable.",
},
InsertText: "string",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -217,7 +217,7 @@ var buckets = map[rune][]protocol.CompletionItem{
int32(117): []protocol.CompletionItem{protocol.CompletionItem{
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "uint8 is the set of all unsigned 8-bit integers.\nRange: 0 through 255.",
Value: "uint8 is the set of all unsigned 8-bit integers. Range: 0 through 255.",
},
InsertText: "uint8",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -226,7 +226,7 @@ var buckets = map[rune][]protocol.CompletionItem{
}, protocol.CompletionItem{
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "uint16 is the set of all unsigned 16-bit integers.\nRange: 0 through 65535.",
Value: "uint16 is the set of all unsigned 16-bit integers. Range: 0 through 65535.",
},
InsertText: "uint16",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -235,7 +235,7 @@ var buckets = map[rune][]protocol.CompletionItem{
}, protocol.CompletionItem{
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "uint32 is the set of all unsigned 32-bit integers.\nRange: 0 through 4294967295.",
Value: "uint32 is the set of all unsigned 32-bit integers. Range: 0 through 4294967295.",
},
InsertText: "uint32",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -244,7 +244,7 @@ var buckets = map[rune][]protocol.CompletionItem{
}, protocol.CompletionItem{
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "uint64 is the set of all unsigned 64-bit integers.\nRange: 0 through 18446744073709551615.",
Value: "uint64 is the set of all unsigned 64-bit integers. Range: 0 through 18446744073709551615.",
},
InsertText: "uint64",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -253,7 +253,7 @@ var buckets = map[rune][]protocol.CompletionItem{
}, protocol.CompletionItem{
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "uint is an unsigned integer type that is at least 32 bits in size. It is a\ndistinct type, however, and not an alias for, say, uint32.",
Value: "uint is an unsigned integer type that is at least 32 bits in size. It is a distinct type, however, and not an alias for, say, uint32.",
},
InsertText: "uint",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -262,7 +262,7 @@ var buckets = map[rune][]protocol.CompletionItem{
}, protocol.CompletionItem{
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "uintptr is an integer type that is large enough to hold the bit pattern of\nany pointer.",
Value: "uintptr is an integer type that is large enough to hold the bit pattern of any pointer.",
},
InsertText: "uintptr",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -273,7 +273,7 @@ var buckets = map[rune][]protocol.CompletionItem{
Detail: "func append(slice []Type, elems ...Type) []Type",
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "The append built-in function appends elements to the end of a slice. If\nit has sufficient capacity, the destination is resliced to accommodate the\nnew elements. If it does not, a new underlying array will be allocated.\nAppend returns the updated slice. It is therefore necessary to store the\nresult of append, often in the variable holding the slice itself:\n\n```\n\tslice = append(slice, elem1, elem2)\n\tslice = append(slice, anotherSlice...)\n\n```\nAs a special case, it is legal to append a string to a byte slice, like this:\n\n```\n\tslice = append([]byte(\"hello \"), \"world\"...)\n```",
Value: "The append built-in function appends elements to the end of a slice. If it has sufficient capacity, the destination is resliced to accommodate the new elements. If it does not, a new underlying array will be allocated. Append returns the updated slice. It is therefore necessary to store the result of append, often in the variable holding the slice itself:\n\n\tslice = append(slice, elem1, elem2)\n\tslice = append(slice, anotherSlice...)\n\nAs a special case, it is legal to append a string to a byte slice, like this:\n\n\tslice = append([]byte(\"hello \"), \"world\"...)",
},
InsertText: "append()",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -292,7 +292,7 @@ var buckets = map[rune][]protocol.CompletionItem{
}, protocol.CompletionItem{
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "byte is an alias for uint8 and is equivalent to uint8 in all ways. It is\nused, by convention, to distinguish byte values from 8-bit unsigned\ninteger values.",
Value: "byte is an alias for uint8 and is equivalent to uint8 in all ways. It is used, by convention, to distinguish byte values from 8-bit unsigned integer values.",
},
InsertText: "byte",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -303,7 +303,7 @@ var buckets = map[rune][]protocol.CompletionItem{
Detail: "func copy(dst, src []Type) int",
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "The copy built-in function copies elements from a source slice into a\ndestination slice. (As a special case, it also will copy bytes from a\nstring to a slice of bytes.) The source and destination may overlap. Copy\nreturns the number of elements copied, which will be the minimum of\nlen(src) and len(dst).",
Value: "The copy built-in function copies elements from a source slice into a destination slice. (As a special case, it also will copy bytes from a string to a slice of bytes.) The source and destination may overlap. Copy returns the number of elements copied, which will be the minimum of len(src) and len(dst).",
},
InsertText: "copy()",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand All @@ -313,7 +313,7 @@ var buckets = map[rune][]protocol.CompletionItem{
Detail: "func cap(v Type) int",
Documentation: protocol.MarkupContent{
Kind: protocol.Markdown,
Value: "The cap built-in function returns the capacity of v, according to its type:\n\n```\n\tArray: the number of elements in v (same as len(v)).\n\tPointer to array: the number of elements in *v (same as len(v)).\n\tSlice: the maximum length the slice can reach when resliced;\n\tif v is nil, cap(v) is zero.\n\n```\nFor some arguments, such as a simple array expression, the result can be a\nconstant.",
Value: "The cap built-in function returns the capacity of v, according to its type:\n\n\tArray: the number of elements in v (same as len(v)).\n\tPointer to array: the number of elements in *v (same as len(v)).\n\tSlice: the maximum length the slice can reach when resliced;\n\tif v is nil, cap(v) is zero.\n\nFor some arguments, such as a simple array expression, the result can be a constant.",
},
InsertText: "cap()",
InsertTextFormat: protocol.InsertTextFormatPlainText,
Expand Down
Loading

0 comments on commit 891e794

Please sign in to comment.