dark icon indicating copy to clipboard operation
dark copied to clipboard

Show source code for builtin function in the UI

Open pbiggar opened this issue 3 years ago • 2 comments
trafficstars

It's useful to users to expose the definition of built-in functions.

If we add a filename and line number to the definition of builtin functions (hopefully using builtin F# features), we could link directly to the code in question (we also have the server's build-hash).

If we also added an ending line number, we could pull in the source code directly from the GitHub raw file.

Phases:

  • add filename, starting line number, and ending line number to all stdlib definition
  • send these to the client
  • use the client to build a link to the function
  • parse the github webpage to read the source code
  • add a syntax highlighting library.

Or is it simpler to pre-process the dark F# codebase to produce a JSON file of F# code, that we can then put in a CDN?

pbiggar avatar Dec 06 '21 20:12 pbiggar

Copied from duplicate, now-closed #3704:

We should provide users with whatever info they need, and this is sometimes useful information. It also helps users become familiar with our GitHub and the fact that they could contribute.

image

StachuDotNet avatar Jun 22 '22 01:06 StachuDotNet

Rather than encoding this within our F# backend, this could encourage a GitHub API package, with which we:

  • fetch all files of pattern Lib*.fs
  • extract the fn defs from there, and use that data to support this feature

May be a non-traditional or roundabout approach, but one that we could support wholly from within Dark.

StachuDotNet avatar Jun 27 '22 23:06 StachuDotNet

merged into #5237

StachuDotNet avatar Jan 09 '24 21:01 StachuDotNet