Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Component: Refactors #5242

Open
14 tasks
StachuDotNet opened this issue Jan 8, 2024 · 0 comments
Open
14 tasks

Component: Refactors #5242

StachuDotNet opened this issue Jan 8, 2024 · 0 comments
Labels
later Let's think about this later -- we have some higher-priority things to work through first

Comments

@StachuDotNet
Copy link
Member

StachuDotNet commented Jan 8, 2024

This issue is to organize work related to Darklang's "refactors" - (usually) editor functionality of augmenting some code based on AST manipulations.

We should advance the language and editor a bit more before advancing here.


How refactors should be applied (general)

  • refactors should manipulate ASTs, and be written in Dark
  • (?) only applicable if they pass some AST query
  • users should be able to highlight some code and explicitly refactor it with commands
  • users should be able to see a list of suggested refactors in-editor
  • we should support some process that crawls throughout a user's code-base making recommendations for more substantial refactors and improvements
  • use AI to help collect and perform refactors (maybe some refactors call upon a prompt rather than manipulate ASTs directly)

Common refactors to include

  • TODO: review all of the commands available in dark-classic
  • fix: extract variable should select the variable so that we can edit its name
  • inline a variable
    • old note: "Add a command to the command palette to inline a variable. Should be a straightforward addition with code in client/src/fluid/Commands.ml and tests in client/test/fluid_command_test.ml"
  • extract all uses of an expression (see Refactoring command to extract all uses of an expression #2702)
  • add / remove pipes
    • If you have a |> b |> c, convert it to (c (b a)). And vice versa.
    • Most useful if you have (func value) and you want to start piping.
  • wrap in if
  • wrap in match
  • convert if to match
@StachuDotNet StachuDotNet added later Let's think about this later -- we have some higher-priority things to work through first needs-review I plan on going through each of the issues and clarifying them -- this is to mark remaining issues labels Feb 8, 2024
@StachuDotNet StachuDotNet removed the needs-review I plan on going through each of the issues and clarifying them -- this is to mark remaining issues label Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
later Let's think about this later -- we have some higher-priority things to work through first
Projects
None yet
Development

No branches or pull requests

1 participant