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

Create hook for vscode settings, styler, and lintr #3

Open
ilyaZar opened this issue Apr 1, 2023 · 0 comments
Open

Create hook for vscode settings, styler, and lintr #3

ilyaZar opened this issue Apr 1, 2023 · 0 comments

Comments

@ilyaZar
Copy link

ilyaZar commented Apr 1, 2023

One idea for a hook that does other things than adding default shiny UI/server could be for convenient project setup in a vscode environment.

I use vscode and whenever I start a golem project with golem::create_golem() I'd like to add the default .vscode, a linter (because the "Error Lens" extension can become quite anoying) and apply a style guide.

One could add convenient ghook::-helper funcs that provide this behaviour. The ghook::-helper funcs would essentially do the following:

  1. create directory .vscode containing a file .vscode/PROJECT_NAME.code-workspace:
    {
    "folders": [
    	{
    		"path": ".."
    	}
    ],
    "settings": {}
    }
    
    This is the default.
  2. add a styler hook:
options(languageserver.formatting_style = function(options) { 
    grkstyle::grk_style_transformer()
#   styler::tidyverse_style(indent_by = options$tabSize)
}) 
styler::style_pkg() 
  1. create a linter file:
lintr::use_lintr(type = "tidyverse")

with extensions passing additional lintr settings https://lintr.r-lib.org/reference/linters_with_defaults.html or copy pasting a lintr template file or somehting like that.

A user defined ghook-hook could then make use of these helper functions that have additional parameters for further customization (e.g. at the styler part I'd add the possibility to use the grk or tidyverse styler, and at the linter part I'd add the possibility to set some default linters via ... or something like that).

Would that be something useful?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant