GithubHelp home page GithubHelp logo

reditorsupport / atom-language-r Goto Github PK

View Code? Open in Web Editor NEW
31.0 31.0 11.0 110 KB

R syntax for Atom

Home Page: https://atom.io/packages/atom-language-r

License: Other

JavaScript 88.68% R 11.32%
atom r rmarkdown

atom-language-r's People

Contributors

arcanemagus avatar guillaumechaumet avatar heavywatal avatar kylebarron avatar lee-dohm avatar markroxor avatar matchilling avatar randy3k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

atom-language-r's Issues

Missing scopes on punctuation

From @chbk on December 7, 2017 23:28

I use r a lot so this package is great, is it still being developed?

If so, I noticed missing scopes on () ,:

sub("_", "", path)
getrootdir(utils::untar(src))
data.frame()
file.exists()

They should be punctuation.definition.parameters.bracket.round.begin|end, punctuation.separator.parameters.comma based on docs.

Copied from original issue: REditorSupport/atom-language-r-legacy#10

Uncaught TypeError: Cannot read property 'length' of undefined

In latest Atom 1.43, atom-language-r 1.4.8 and r-languageserver 0.3.3 once you start typing code in a R file I get constant Uncaught TypeError: Cannot read property 'length' of undefined errors and stack traces in Atom. Cannot tell if this is an r-languageserver problem or atom-language-r problem but seem to be the latter.

This problem is severe enough that it makes it impossible to work with R files.

"_blank" messes up syntax highlighting for Rmd files

I use the following setup frequently in Rmd files <a href="https://www.rstudio.com/shiny/" target="_blank">Shiny</a>. The unclosed _, however, messes up the syntax highlighting.

I thought about creating a PR but there a bunch of sections there referenced 'italic' in grammars/rmd.cson so I wasn't sure where to start.

Unable to start the R language server.

After install the ide-r and atom-language-r packages, i restart Atom and receive this message:

"Unable to start the R language server.
This can occur if Atom cannot find R or the server is not installed.

Make sure you have both R and languageserver installed.
Install Instructions"

I set the absolute path to R as: c:\Program Files\r\R-3.4.2\bin\

Uncaught TypeError: Cannot read property 'endsWith' of undefined

[Enter steps to reproduce:]

  1. Return/Enter at the first line

Atom: 1.24.0 x64
Electron: 1.6.16
OS: Mac OS X 10.12.6
Thrown From: atom-language-r package 1.1.0

Stack Trace

Uncaught TypeError: Cannot read property 'endsWith' of undefined

At /Users/watal/git/dotfiles/.atom/packages/atom-language-r/lib/r-indent.js:199

TypeError: Cannot read property 'endsWith' of undefined
    at RIndent.endsWithAssignment (/packages/atom-language-r/lib/r-indent.js:199:17)
    at RIndent.properlyIndent (/packages/atom-language-r/lib/r-indent.js:36:42)
    at HTMLElement.editorNewline (/packages/atom-language-r/lib/main.js:22:52)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:388:36)
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
    at WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:108:40)

Commands

     -1:03.1.0 application:new-file (atom-pane.pane.active)
  2x -1:01.4.0 editor:newline (input.hidden-input)
  2x -1:00.5.0 core:move-up (input.hidden-input)
  2x -0:57.6.0 grammar-selector:show (atom-text-editor.editor.is-focused)
     -0:50.1.0 core:move-down (input.hidden-input)
     -0:49.7.0 core:confirm (input.hidden-input)
     -0:48.9.0 editor:newline (input.hidden-input)

Non-Core Packages

atom-language-r 1.1.0 
atom-material-ui 2.1.3 
autocomplete-paths 2.12.2 
autocomplete-python 1.10.5 
busy-signal 1.4.3 
color-picker 2.2.5 
file-icons 2.1.17 
intentions 1.1.5 
language-babel 2.84.0 
language-cmake 1.1.0 
language-latex 1.1.1 
language-markdown 0.25.1 
latex 0.49.0 
linter 2.2.0 
linter-chktex 1.3.1 
linter-eslint 8.4.1 
linter-flake8 2.3.0 
linter-stylelint 4.2.0 
linter-ui-default 1.7.1 
markdown-writer 2.7.3 
minimap 4.29.8 
pigments 0.40.2 
project-manager 3.3.5 
r-exec 0.5.0 

Possible problem with compile

In the file language-r.cson Version 1.4.8, I keep getting an error message upon install:

Error message:
Failed to load snippets from '/Users/tgrrr/.atom/packages/language-r/snippets/language-r.cson'

/Users/tgrrr/.atom/packages/language-r/snippets/language-r.cson: Duplicate key 'Cummulative max'

# language-r.cson:
  'Cummulative max':
    'prefix': 'cumi'
    'body': 'cummax(${1:x})'
  'Cummulative max':
    'prefix': 'cuma'
    'body': 'cummin(${1:x})'

/Users/phil/.atom/packages/language-r/snippets/language-r.cson: Duplicate key 'Grep'

'Grep':
    'prefix': 'grep'
    'body': 'grep(${1:pattern}, ${2:x}, ${3:ignore.case = ${4:FALSE}}, ${5:perl = ${6:FALSE}})'
  'Grep':
    'prefix': 'grep'
    'body': 'grep(${1:pattern}, ${2:x}, ${3:ignore.case = ${4:FALSE}}, ${5:perl = ${6:FALSE}}, ${7:value = ${8:FALSE}}, ${9:fixed = ${10:TRUE}})'

The code is right on github, but not when I install the package in atom (both with the UI, and apm install). Is it possible that there's an error in compile?

Failed to load a atom-language-r package grammar

Happens on load.

Atom: 1.25.0-beta2 x64
Electron: 1.7.11
OS: Mac OS X 10.13.3
Thrown From: atom-language-r package 1.1.0

Stack Trace

Failed to load a atom-language-r package grammar

At Unsupported selector 'month.abb' in /Users/laughedelic/.atom/packages/atom-language-r/grammars/tree-sitter-r.cson

TypeError: Unsupported selector 'month.abb'
    at rejectSelector (/Applications/Atom Beta.app/Contents/Resources/app/src/syntax-scope-map.js:177:15)
    at Processor.parser [as func] (/Applications/Atom Beta.app/Contents/Resources/app/src/syntax-scope-map.js:90:21)
    at Processor.process (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/postcss-selector-parser/dist/processor.js:34:20)
    at SyntaxScopeMap.addSelector (/Applications/Atom Beta.app/Contents/Resources/app/src/syntax-scope-map.js:96:14)
    at new SyntaxScopeMap (/Applications/Atom Beta.app/Contents/Resources/app/src/syntax-scope-map.js:9:18)
    at new TreeSitterGrammar (/Applications/Atom Beta.app/Contents/Resources/app/src/tree-sitter-grammar.js:38:27)
    at GrammarRegistry.createGrammar (/Applications/Atom Beta.app/Contents/Resources/app/src/grammar-registry.js:486:20)
    at CSON.readFile (/Applications/Atom Beta.app/Contents/Resources/app/src/grammar-registry.js:468:35)
    at /Applications/Atom Beta.app/Contents/Resources/app/node_modules/season/lib/cson.js:223:65
    at tryToString (fs.js:449:3)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:436:12)
  at /packages/atom-language-r/grammars/tree-sitter-r.cson:1:1

Non-Core Packages

advanced-open-file 0.16.7 
antialiased 0.1.0 
ariake-dark-syntax 0.1.3 
atom-csv-markdown 1.0.2 
atom-ide-ui 0.9.2 
atom-jade 0.3.0 
atom-language-r 1.1.0 
atom-markdown-wrapper 5.2.2 
atom-material-ui 2.1.3 
atom-sbt-client 0.2.0 
autoclose-html 0.23.0 
autocomplete-emojis 2.5.0 
autocomplete-paths 2.12.2 
autoflow-diffable 0.5.0 
base16-syntax 1.8.1 
busy-signal 1.4.3 
cursor-history 0.13.1 
dash 1.7.1 
factoids 0.1.1 
file-icons 2.1.17 
file-types 0.5.5 
git-plus 7.10.0 
gl-light-syntax 3.0.0 
highlight-selected 0.13.1 
Hydrogen 2.2.3 
hyperclick 0.0.0 
hyperlink-hyperclick 1.3.4 
ide-flowtype 0.21.0 
ide-java 0.8.1 
ide-json 0.2.1 
ide-python 0.8.1 
ide-typescript 0.7.5 
inline-git-diff 2.3.0 
key-peek 0.2.12 
language-diff 0.7.0 
language-elm 1.5.0 
language-fish-shell 1.1.0 
language-gitignore 0.3.0 
language-haskell 1.17.3 
language-hocon 1.1.0 
language-latex 1.1.1 
language-pfm 0.82.0 
language-plantuml 0.2.0 
language-rdf 0.5.0 
language-roff 1.2.2 
language-scala 1.1.9 
language-sparql 0.3.0 
latex-completions 0.3.3 
line-diff-details 1.9.0 
linter 2.2.0 
linter-annotations 1.0.2 
linter-coffeescript 1.0.0 
linter-js-standard 5.0.0 
linter-travis-lint 1.0.0 
markdown-folder 0.5.0 
markdown-preview-enhanced 0.15.2 
markdown-table-formatter 2.9.2 
mathjax-wrapper 0.1.0 
mixed-indent-warning 0.3.0 
native-ui 0.25.2 
one-dark-vivid-syntax 1.8.0 
pen-paper-coffee-syntax 0.14.9 
pigments 0.40.2 
plain-simple 1.1.0 
plantuml-preview 0.12.9 
plist-converter 0.2.0 
pretty-json 2.0.0 
project-folder 1.5.0 
remember-folds 0.3.0 
set-syntax 0.4.0 
simple-align 0.2.0 
sort-lines 0.18.0 
standard-formatter 2.8.0 
standardjs-snippets 2.6.2 
swackets 0.35.0 
tablr 1.8.3 
teletype 0.9.0 
terminal-tab 0.5.4 
toggle 0.6.2 
trailing-spaces 0.4.0 
tree-view-autoresize 2.3.0 
vim-mode-plus 1.30.0 
vim-mode-plus-keymaps-for-surround 0.2.1 
xml-formatter 0.11.0 

Request: NON base-R function syntax highlighting

The request is in the title. I have custom packages loaded, which use their own functions. Without fail, every syntax theme will highlight base R functions one way, and completely ignore non-base R functions.

Meanwhile, autocompletion (from autocomplete or IDE components of atom, I'm not sure) is able to keep track of which custom functions are loaded.
atom-language-r should, in theory, be able to pull from those and treat them as functions, correct?

Seeing as R's beauty arises in part from the package support it has, this seems like a baseline functionality to implement.

Thank you!

Color Scheme

How do I can change the grammar R coloring?

Thx

Toggle comment on text produces JavaScript comments instead of HTML (Rmd default)

Atom 1.43.0
atom-language-r 1.4.8

Issue: Selecting text in a Rmd and toggling comments, produces the wrong comment tags.

How to reproduce

  1. Select text in R markdown file.
  2. Press CTRL+/ to toggle comment.

Result: JavaScript comment delimiters (/* */) are produced instead of HTML comment tags.

Expected result: HTML comment tags around the selected text.

Suppress indent on newline after closing curly braces

When I hit the return key right after a closing brace,

for (i in seq_len(3L)) {
  print(i)
}|

I expect no indent:

for (i in seq_len(3L)) {
  print(i)
}
|

But atom-languege-r 1.3.0 makes extra indent:

for (i in seq_len(3L)) {
  print(i)
  }
  |

Interestingly, command-z has to be done twice to undo this change. Thanks.

Atom: 1.24.0 x64
Electron: 1.6.16
OS: Mac OS X 10.12.6

RMarkdown whitespace indentation

The whitespace package will avoid removing trailing whitespace for markdown files by default, but this is not done for .Rmd files, so trailing white space is trimmed and it often leads to poorly formatted outputs upon knitting.

image

I'm not sure if some designation needs to be made in that package or this one, but I remember Rmd files working previously in this way.

Unable to start the R language server

Mesmo erro que outros usuários identificaram:
Não tenho a menor ideia de como resolver.

Agradeço qualquer retorno, por que não estou entendendo o que não vejo.

`Unable to start the R language server.
This can occur if Atom cannot find R or the server is not installed.

Make sure you have both R and languageserver installed.`

how to contribute?

Hi, it seems that there were no updates to this package for a year now. How one can contribute? I would like to fix few pain points I have with indentation but I'm fairly new to Atom and especially its package system.

Failed to load snippets ubuntu 18.04

Error with Ubuntu 18.04 fresh installation.

 from '/home/serg/.atom/packages/language-r/snippets/language-r.cson'
/home/serg/.atom/packages/language-r/snippets/language-r.cson: Duplicate key 'Cummulative max'

Regular expression support

From @kylebarron on October 2, 2017 4:56

Add regular expression support, similar to the implementations in language-python and language-stata.
image

This is non-trivial in R because it's harder to tell when a string is used to match something else, or when it's a literal string, and it should be matched. I looked through documentation and in general, the functions that have the regex in the first slot are grep grepl regexpr gregexpr sub gsub regexec regex, and the functions that have it in the second slot are

\\b(strsplit|stri_(count|detect|extract|locate|match|replace|split|startswith|endswith|subset)[_a-z]*|str_(count|detect|split|subset|which)|str_(extract|locate|match|replace|view)(_all)?)

Hopefully I'll be able to use this to color the object in the first or second slot for those functions.

Note to self: Don't use syntax highlighting withing a fixed() call.

Copied from original issue: REditorSupport/atom-language-r-legacy#5

RStudio-like indentation

From @kylebarron on October 13, 2017 16:29

R-indent, a fork of Python-indent, contains code to have RStudio-like indentation after the %>% and + operators, but the R-indent package is not currently published on the Atom package manager.

I'm thinking about adding the MIT-licensed R-indent code to this repository, since indentation is usually a function that a language package takes care of (at least giving characters after which the indentation should increase or decrease). I'll look at updating the R-indent code to the most recent Python-indent version, since R-indent is 17 commits behind master.

Copied from original issue: REditorSupport/atom-language-r-legacy#7

Strings with curly braces in R markdown breaks highlighting

In a .Rmd document, if a chunk option has a string containing curly braces, highlighting breaks if the R Markdown grammar is selected. (Latest Atom version and atom-language-r version).

In the following example, the chunk option fig.cap is a string with a LaTeX command using curly braces (\\Cref{s:pilot}).

Screenshot 2019-05-13 at 12 54 15

If the closing brace is removed, highlighting is restored.

Screenshot 2019-05-13 at 12 54 28

Uncaught TypeError: Cannot read property 'getGrammar' of undefined

Steps to reproduce:

  1. Open Atom v1.25.0-beta0
  2. Have no open files
  3. Hit enter in the github commit message box

Atom: 1.25.0-beta1 x64
Electron: 1.7.11
OS: Microsoft Windows 10 Enterprise
Thrown From: atom-language-r package 1.0.2

Stack Trace

Uncaught TypeError: Cannot read property 'getGrammar' of undefined

At C:\Users\abneyl\.atom\packages\atom-language-r\lib\r-indent.js:5

TypeError: Cannot read property 'getGrammar' of undefined
    at RIndent.properlyIndent (/packages/atom-language-r/lib/r-indent.js:5:37)
    at HTMLElement.editorNewline (/packages/atom-language-r/lib/main.js:22:52)
    at CommandRegistry.handleCommandEvent (~/AppData/Local/atom/app-1.25.0-beta1/resources/app/src/command-registry.js:384:49)
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (~/AppData/Local/atom/app-1.25.0-beta1/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (~/AppData/Local/atom/app-1.25.0-beta1/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
    at WindowEventHandler.handleDocumentKeyEvent (~/AppData/Local/atom/app-1.25.0-beta1/resources/app/src/window-event-handler.js:110:40)

Commands

     -6:06.2.0 core:confirm (span.github-FilePatchListView-path)
     -5:38.4.0 docblockr:parse-enter (input.hidden-input)
     -5:38.4.0 editor:newline (input.hidden-input)
     -5:38.2.0 docblockr:parse-enter (input.hidden-input)
     -5:38.2.0 editor:newline (input.hidden-input)
     -2:20.6.0 editor:move-to-end-of-screen-line (input.hidden-input)
 11x -2:15.8.0 editor:delete-to-beginning-of-word (input.hidden-input)
     -1:59.5.0 docblockr:parse-enter (input.hidden-input)
     -1:59.5.0 editor:newline (input.hidden-input)
     -1:59.3.0 docblockr:parse-enter (input.hidden-input)
     -1:59.3.0 editor:newline (input.hidden-input)

Non-Core Packages

Package list
atom-beautify 0.30.9 
atom-ide-ui 0.8.1 
atom-language-r 1.0.2 
atom-material-ui 2.1.3 
autocomplete-lua 0.9.0 
busy-signal 1.4.3 
docblockr 0.13.6 
editorconfig 2.2.2 
file-watcher 1.2.6 
highlight-selected 0.13.1 
ide-flowtype 0.19.0 
ide-php 0.7.6 
ide-python 0.8.0 
ide-typescript 0.7.3 
intentions 1.1.5 
language-ansible 0.2.2 
language-chef 0.11.0 
language-cjson 0.0.1 
language-docker 1.1.8 
language-elixir 0.22.0 
language-erlang 3.2.0 
language-fortran 2.1.6 
language-gettext 0.6.1 
language-glsl 2.0.4 
language-haml 0.25.2 
language-haskell 1.17.3 
language-icinga2 0.4.1 
language-ini 1.19.0 
language-jade 0.7.2 
language-jolie 0.5.0 
language-kotlin 0.5.0 
language-livescript 0.0.3 
language-lua 0.9.11 
language-moonscript 1.7.1 
language-postcss 1.3.1 
language-powershell 4.0.0 
language-pug 0.0.22 
language-puppet 0.23.0 
language-reg 0.0.0 
language-rust 0.4.12 
language-swift 0.5.0 
language-terraform 0.8.1 
language-vue 0.23.1 
linter 2.2.0 
linter-coffeelint 1.3.1 
linter-eslint 8.4.1 
linter-flake8 2.3.0 
linter-htmlhint 1.4.0 
linter-js-standard 4.2.0 
linter-js-yaml 1.2.8 
linter-jsonlint 1.3.0 
linter-markdown 5.2.0 
linter-perl 0.8.2 
linter-perlcritic 2.0.0 
linter-php 1.5.1 
linter-phpcs 1.6.8 
linter-phpmd 2.0.0 
linter-proselint 3.3.0 
linter-pylama 0.9.5 
linter-pylint 2.1.1 
linter-rails-best-practices 0.2.2 
linter-reek 2.2.2 
linter-rubocop 2.2.3 
linter-ruby 1.2.6 
linter-stylelint 4.2.0 
linter-tidy 2.3.1 
linter-ui-default 1.6.10 
linter-ui-plus 0.3.2 
mapfile-grammar 0.1.0 
minimap 4.29.7 
minimap-git-diff 4.3.1 
minimap-highlight-selected 4.6.1 
minimap-linter 2.1.3 
minimap-selection 4.5.0 
sequential-number 0.5.0 
sort-lines 0.18.0 
tab-control 0.6.10 
teletype 0.8.0 
terminal-tab 0.5.3 
toggle-quotes 1.1.0 
trailing-spaces 0.4.0 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.