diff --git a/_quarto.yml b/_quarto.yml index 0949758..b184a45 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -30,6 +30,7 @@ book: - chapters/where_to_get_help.qmd - chapters/news_and_announcements.qmd - chapters/developer_tools.qmd + - chapters/ide_setup.qmd - chapters/additional_resources.qmd - chapters/r_core_developers.qmd diff --git a/chapters/ide_setup.qmd b/chapters/ide_setup.qmd new file mode 100644 index 0000000..d02ca7b --- /dev/null +++ b/chapters/ide_setup.qmd @@ -0,0 +1,84 @@ +# IDE Setup {sec-ide-setup} + +**Note:** + +Mention of these IDEs is not meant as a recommendation for either of them, just an acknowledgement that they're common choices. + +## For VSCode + +If you already have an `EditorConfig` set-up, merge the settings below into it. Otherwise, create it with the settings below. + +``` +{ + // Editor settings for C files + // Cannot set to auto replace 8 spaces with tab (https://github.com/Microsoft/vscode/issues/ #42740, #5394) + "[c]": { + // An indent is 4 spaces + "editor.indentSize": 4, + // But display 8 spaces as a single tab + "editor.tabSize": 8, + // Need this to get indent size 4, else uses tabs to indent + "editor.insertSpaces": true, + // If set true, detects settings from the code in the file + "editor.detectIndentation": false, + }, + // Editor settings for R files + "[r]": { + "editor.indentSize": 4, + "editor.tabSize": 8, + "editor.insertSpaces": true, + "editor.detectIndentation": false + }, + // There isn't a formatter that works great with R itself + "editor.formatOnSave": false, + // Shows the difference between 4 spaces and 8 spaces (tab) visually + "editor.renderWhitespace": "all", + // Show whitespace changes in the diff editor to help us get it right + // Trim trailing whitespace after a line, or on a blank line. + // You may need to turn this off in some files where historically + // trailing whitespace has not been trimmed, but otherwise it is + // good practice to trim it. + "files.trimTrailingWhitespace": true, + // Turn off {languageserver} linting for R files + "r.lsp.diagnostics": false +} +``` + +## For Positron + +If you already have an `EditorConfig` set-up, merge the settings below into it. Otherwise, create it with the settings below. These settings are the same as for VSCode, with the exception of `r.lsp.diagnostics` as Positron does not use a R language server. + +``` +{ + // Editor settings for C files + // Cannot set to auto replace 8 spaces with tab (https://github.com/Microsoft/vscode/issues/ #42740, #5394) + "[c]": { + // An indent is 4 spaces + "editor.indentSize": 4, + // But display 8 spaces as a single tab + "editor.tabSize": 8, + // Need this to get indent size 4, else uses tabs to indent + "editor.insertSpaces": true, + // If set true, detects settings from the code in the file + "editor.detectIndentation": false, + }, + // Editor settings for R files + "[r]": { + "editor.indentSize": 4, + "editor.tabSize": 8, + "editor.insertSpaces": true, + "editor.detectIndentation": false + }, + // There isn't a formatter that works great with R itself + "editor.formatOnSave": false, + // Shows the difference between 4 spaces and 8 spaces (tab) visually + "editor.renderWhitespace": "all", + // Show whitespace changes in the diff editor to help us get it right + "diffEditor.ignoreTrimWhitespace": false, + // Trim trailing whitespace after a line, or on a blank line. + // You may need to turn this off in some files where historically + // trailing whitespace has not been trimmed, but otherwise it is + // good practice to trim it. + "files.trimTrailingWhitespace": true +} +``` diff --git a/chapters/introduction.qmd b/chapters/introduction.qmd index 74b2c34..39a566e 100644 --- a/chapters/introduction.qmd +++ b/chapters/introduction.qmd @@ -46,6 +46,8 @@ The guide is intended as a comprehensive resource for contributing to base R. Th - Tools that may be useful for R developers are available in the [Developer Tools](#sec-dev-tools) chapter. +- Editor settings for common IDEs are suggested in the [IDE Setup](sec-ide-setup) chapter. + - Additional resources for contributing to R are available in the [Additional Resources](#sec-additional-resources) chapter. - The [R Core Developers](#sec-core-dev) chapter contains a list of the former and current members of the R Core Team who have write access to the R source.