Scala grammar for Atom. Originally converted from the Scala TextMate bundle. Also available as a Node package.
atom-community / language-scala Goto Github PK
View Code? Open in Web Editor NEWLanguage support for Scala in Atom.
Language support for Scala in Atom.
Scala grammar for Atom. Originally converted from the Scala TextMate bundle. Also available as a Node package.
Could you please publish the scala module to npm? We are using the same highlighting engine as Atom now, and would love to add your grammar:
This is slightly complicated, and I'm still working through the scala spec. etc. to work out what should happen, but probably an example is the best place to start:
In grammars/scala.cson there is:
'match': '(==?|!=|<=|>=|<>|<|>)'
'name': 'keyword.operator.comparison.scala'
This matches ===
as ==
then =
, which is incorrect - the whole ===
is a function name, defined by say scalaz as an improved comparison.
In fact ==
itself isn't really a keyword, it's also a method, with an "operator identifier" consisting of symbols.
Since methods aren't assigned a style, it would seem to be the correct behaviour to just get rid of these matches, and leave ==
, ===
, >=
etc. unstyled?
To work properly the following would also need fixing:
'match': '(<-|←|->|→|=>|⇒|\\?|\\:+|@|\\|)+'
'name': 'keyword.operator.scala'
Since this will catch stuff like >=>
, which I think is a valid function or variable name, not a =>
keyword. I've had a quick look at what could be done to avoid catching this, and it might look something like:
'captures':
'2':
'name': 'keyword.operator.scala'
'match': '([^!#%&*+\-/:<=>?@\\^|~])(<-|←|->|→|=>|⇒|\\?|\\:+|@|\\|)+([^!#%&*+\-/:<=>?@\\^|~])'
This requires that there is a non-operator character both before and after the keyword. Since operator identifiers need to contain only operator OR alphanumeric characters I think this should work reasonably well. However it's definitely not completely correct since there are more operator characters - unicode mathematical symbols etc., and there's something to do with using an underscore between operator characters and alphanumerics. There's more here: http://stackoverflow.com/questions/7656937/valid-identifier-characters-in-scala
On a side-note, the keyword.operator.comparison.scala
match above also catches =
, which is a keyword but not comparison?
I ran into this while using fira code to get nice ligatures for stuff like <-
and =>
- when you type ===
it gets broken up into two spans for styling, so you don't get the "triple equals" ligature, but a "double equals" ligature then a normal equals sign. The same thing affects other ligatures like '<=<'.
I've submitted a pull request for this, it may not be usable directly but should show approximately what I mean...
The following code gets highlighted incorrectly:
0 #:: Stream(1)
The second :
is not being highlighted as part of the method name, even though it is.
Demo.
This exact same bug is present in the Scala TextMate bundle (mads-hartmann/scala.tmbundle/issues/60), which is currently used by Linguist, so you'll see the same problem in the code block above.
The following code gets highlighted incorrectly:
def `'`() = ()
`'`()
Demo.
This exact same bug is present in the Scala TextMate bundle (mads-hartmann/scala.tmbundle/issues/59), which is currently used by Linguist, so you'll see the same problem in the code block above.
I thought it's related to #31, but it happens even without comments in the type parameters list. I think it's more about multiline parameters:
Example: https://i.imgur.com/8lJOMzu.png
Not sure why, but this package can not identify scala source code with extension .scalaX and .sc?
May I have your help to advise?
We plan create a fork at https://github.com/atom-community, and to point the Atom package listing entry to this fork on June 1st provided no interaction on this thread. Other options:
Thanks!
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:566:9)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:168:43)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:147:15)
Package.load (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:161:12)
Hello, @jroesch.
It does not look like you interested in supporting this repo. Maybe you will add collaborators and share instructions to publish package?
Thanks.
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:582:9)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:184:43)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:163:15)
Package.load (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:177:12)
PackageManager.loadPackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:355:14)
PackageManager.loadPackages (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:325:14)
Hi! Probably it is related to #36 fix - unfortunately can not say as far as didn't see the error shown on the attached image before package update.
The change log stops at version 1.1.3
. Please consider updating it.
As discussed in the discord chat, we decided to merge atom-community into atom-ide-community
I think this issue might be reported with different triggers.
I did not see this particular trigger so I've added a new request in the hopes that it help clarify the problem(s).
I suspect that when one falls the rest will follow :)
Then again I'm an optimist...
In a line of Scala with an equals sign the "green -- ergo this is a comment" colouring goes to the end of the document IF the equals does not have a space after it.
atom -v
Atom : 1.19.5
Electron: 1.6.9
Chrome : 56.0.2924.87
Node : 7.4.0
Sample one with space: GOOD
Sample two without a space: BAD
Set Atom's global setting tab length to 4, the tab length in language-scala plugin automatically jump back to 4 (the default value) when setting it to 2.
Do you plan to add tree-sitter-scala support into your nice plugin?
Similar to other atom/language-*
packages like: https://github.com/atom/language-javascript
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:566:9)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:168:43)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:147:15)
Package.load (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:161:12)
Having a changelog.md is important for users to know what changed in terms of API, feature additions, bug fixes, performance changes, feature additions, etc.
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/Applications/Atom.app/Contents/Resources/app/src/package.js:565:9)
<unknown> (/Applications/Atom.app/Contents/Resources/app/src/package.js:187:43)
I'm not sure how exactly to fix this, but having an inline block comment that happens to be in a type parameter seems to break the syntax highlighting.
I'm converting some code, whereby I'm removing a type parameter. I've simply commented out the specific type parameter, but the comment is not highlighted correctly.
Normal one line block comments are fine:
def foo(x: Int) = { /* this works */ 5 }
But the following breaks:
def foo[S,/*F[_]:Foldable,*/ A](x: Int) = 5
I've narrowed it down to the [
which changes the pattern, causing the highlight to not work.
I'd like to be able to comment a line with // rather than /**/
This is an oddly specific issue, and just a minor annoyance, but if I've understood correctly, it traces back to the syntax theme (see tonsky/FiraCode#63).
The issue is that ~> is not turned into its ligature when using Fira Code, which generally means it has been broken up into two tokens (e.g., because of spans).
Is it possible to make it so that ~> characters are consecutive so that the ligature may trigger ?
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:582:9)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:184:43)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:163:15)
Package.load (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:177:12)
PackageManager.loadPackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:355:14)
PackageManager.loadPackages (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:325:14)
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/usr/share/atom/resources/app.asar/src/package.js:566:9)
<unknown> (/usr/share/atom/resources/app.asar/src/package.js:168:43)
Package.measure (/usr/share/atom/resources/app.asar/src/package.js:147:15)
Package.load (/usr/share/atom/resources/app.asar/src/package.js:161:12)
One of the two merged in v1.1.9 pull-requests: #52 or #42 broke something.
I'm using Scala grammar when working with the Play Twirl templates. It's a mix of HTML and Scala code, but as Scala highlights XML tags, it generally worked fine with Scala grammar. But in the last update something broke:
Here's how it looked with v1.1.8:
The package doesn't support strings surrounded by triple "
.
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (C:\Users\Lucena\AppData\Local\atom\app-0.190.0\resources\app\src\package.js:550:9)
<unknown> (C:\Users\Lucena\AppData\Local\atom\app-0.190.0\resources\app\src\package.js:172:43)
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:566:9)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:168:43)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:147:15)
Package.load (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:161:12)
when i use this plus, i can't get the effect like the idea, it can't show the function's param type! sometimes i input a class name( scala lib's class or my class ) or object name and add a "." after class name, it can't show the functions in this class or object !
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:566:9)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:168:43)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:147:15)
Package.load (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:161:12)
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:566:9)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:168:43)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:147:15)
Package.load (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:161:12)
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:586:9)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:188:43)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:167:15)
Package.load (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:181:12)
The following code gets highlighted incorrectly:
def `/*`() = ()
`/*`()
The second /*
is being treated as if it were the start of a block comment, even though it's inside backticks.
Demo.
This exact same bug is present in the Scala TextMate bundle (mads-hartmann/scala.tmbundle/issues/58), which is currently used by Linguist, so you'll see the same problem in the code block above.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.