Skip to content

Commit

Permalink
Simplify get_global_spelling function, with less dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
rfsaldanha committed Mar 19, 2024
1 parent 2a16061 commit c4f8bb6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
6 changes: 1 addition & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
Imports:
cli,
fs,
httr2,
jsonlite,
rappdirs,
rstudioapi,
stringr,
tibble,
tidyr,
xfun
tidyr
URL: https://rfsaldanha.github.io/rspell/
16 changes: 1 addition & 15 deletions R/get_global_spelling.R
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
get_global_spelling <- function(){
# Read RStudio global settings

if (xfun::is_windows()) {
base <- rappdirs::user_config_dir("RStudio", appauthor = NULL)
} else {
base <- rappdirs::user_config_dir("rstudio", os = "unix")
}

res <- jsonlite::read_json(path = fs::path(base, "/rstudio-prefs.json"))

# Isolate spelling dictionary
if(is.null(res$spelling_dictionary_language)){
lang <- "en_US"
} else {
lang <- res$spelling_dictionary_language
}
lang <- rstudioapi::readRStudioPreference(name = "spelling_dictionary_language", default = "en_US")

# Formatting
lang <- stringr::str_replace(
Expand Down

0 comments on commit c4f8bb6

Please sign in to comment.