Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(completion): fix documentation for function completion items #210

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion server/src/completion/ReferenceCompletionProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
WeightedCompletionItem,
} from "@server/completion/WeightedCompletionItem"
import {StructTy} from "@server/types/BaseTy"
import {tactCodeBlock} from "@server/documentation/documentation"

export class ReferenceCompletionProcessor implements ScopeProcessor {
public constructor(private readonly ctx: CompletionContext) {}
Expand Down Expand Up @@ -100,7 +101,7 @@ export class ReferenceCompletionProcessor implements ScopeProcessor {
labelDetails: {
detail: signature,
},
documentation: `fn ${name}${signature}`,
documentation: tactCodeBlock(`fun ${name}${signature}`),
insertText: insertText,
insertTextFormat: InsertTextFormat.Snippet,
weight: contextWeight(
Expand Down
1 change: 1 addition & 0 deletions server/src/documentation/documentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {trimPrefix} from "@server/utils/strings"

const CODE_FENCE = "```"
const DOC_TMPL = `${CODE_FENCE}tact\n{signature}\n${CODE_FENCE}\n{documentation}\n`
export const tactCodeBlock = (s: string): string => `${CODE_FENCE}tact\n${s}\n${CODE_FENCE}`

/**
* Returns the documentation for the given symbol in Markdown format, or null
Expand Down