Skip to content

Conversation

@spotandjake
Copy link
Member

This pr implements an add graindoc code action that lets you add a graindoc template to let expressions and modules.

by default for a value or module we add:

/**
 *
 *
 * @example
 *
 * @since
 */

and for a function we add:

/**
 *
 *
 *
 * @param a:
 * @param b:
 * @returns 
 * @example
 *
 * @since
 */
provide let x = (a, b) => a + 1

This pr isn't quite ready to merge as it still needs tests but I wanted to get some feedback on this before writing those.

Closes: #2301

@spotandjake spotandjake self-assigned this Feb 6, 2026
@spotandjake spotandjake added the graindoc Issues related to Graindoc label Feb 6, 2026
@spotandjake spotandjake added the lsp Issues related to the language server. label Feb 6, 2026
@spotandjake spotandjake force-pushed the spotandjake/code_action_graindoc branch from 1d07c69 to 8be2044 Compare February 10, 2026 23:45
@spotandjake spotandjake requested a review from peblair as a code owner February 10, 2026 23:45
@spotandjake
Copy link
Member Author

spotandjake commented Feb 10, 2026

Tests have been added

Just some notes in response to the community call:

  • The tab jumps thing that was mentioned over the community meeting isn't something we can do in a code action; this is something we can implement when we get autocomplete and have autocompleted doc blocks.
  • I don't think we should have placeholder descriptions, as I think they are more likely to get left there by the user.
  • If we like the code action, I'll come back in the future and open a pr to add it in more places, such as type definitions and the parent module description, as they'll take more work.

[
(
lsp_range(
(1, 4611686018427387871),
Copy link
Member Author

@spotandjake spotandjake Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't quite sure if this is worthy of a code commnt, but this number should be Int.max_int however it seems that yojson treats these internally as IEEE-754 and we are getting some rounding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

graindoc Issues related to Graindoc lsp Issues related to the language server.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lsp: Add graindoc code action.

1 participant