Skip to content

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

@ilyaZar

Description

@ilyaZar

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions