crystal-lang-tools / sublime-crystal Goto Github PK
View Code? Open in Web Editor NEWCrystal syntax highlighting for Sublime Text
License: Other
Crystal syntax highlighting for Sublime Text
License: Other
Hello,
When i save a file .cr
I tabulate my code with spaces, all of then are deleted.
var1 = "var1"
myvar2 = "myvar2"
=>
var1 = "var1"
myvar2 = "myvar2"
How to delete this action and move it to a function key.
Saving my code should not transforme my code silently, without permission !
See: #19 (comment)
Currently, the .ecr
files are being shown as Plain Text files. I couldn't find a way to syntax highlight there. I think it should be a part of official crystal sublime package.
sublime is always a bit behind atom in terms of user friendly tooling but do you have plans to enable these tooling options for sublime? (if this does not require too much hacking)
and there is a crystal tool hierarchy json
option which could enable sensitive auto completion some day maybe?
def initialize(states : State(S, A))
@states << states
end
have an issue at State(>>>(<<<S,A))
using sublime 3 and Monokai, Mariana or other themes (just plain, no special config afaik)
thanks for auto format in sublime, works great!
How about adding https://github.com/TechMagister/cracker to this tool?
Hi @matiasgarciaisaia some Crystal community members have the idea of a Crystal Tools organization inspired by Julia Editor Support organization.
We are adding repositories for sublime, emacs, vim, vscode, atom, etc. All in one place well documented easy to follow, collaborate and maintain. :-)
If you accept the proposal of move your repo to Crystal Tools organization, leave a message in Gitter room first.
The editor support for a language is very important. Thanks you for this awesome sublime plugin. ๐
https://github.com/faustinoaq/vscode-crystal-lang/issues/7 discovered by @Qwerp-Derp
Is already fixed on VSCode but not in Sublime Text.
--format
option has been removed in crystal-lang/crystal#7257, and crystal tool format
is now able to output raw text only. It still can be fetched with Regex. Sadly, but column numbers are gone ๐ข
Error: Syntax error in ./src/ext/pg/converters/uuid.cr:5: expecting token 'CONST', not 'ds'
def read(t : ds.class)
This issue was discovered by @girng
Solution proposed by @oprypin :
sublime-crystal/crystal_format.py
Line 30 in d4abc5a
if operating_system == 'win':
# Prevent flashing windows if used from a GUI application
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
rc = subprocess.call(proc, stdout = pipe, stderr = pipe,
startupinfo = startupinfo)
after I upgrade crystal to 0.13, sublime runs slowly. I can't even edit crystal files.
but atom editor works fine.
I was converting some Ruby code to Crystal (for Geode) and I noticed that certain functions, methods, and format strings weren't being highlighted, which I then noticed was a side effect of there not being any special scopes for them.
I don't know if I am the only one experiencing this, but when I press save the plugin removes all the empty lines in my program..
The indentation is useful. But I want some whitespace between some of my code blocks.
Does anyone have a solution for this?
Describe the bug
Syntax highlighting starts doing weird things when there are generic types in a parameter list.
To Reproduce
Paste this snippet to sublime code buffer with Crystal syntax selected:
def func(a : String, b : Array(String), c : String)
p a
end
Expected behavior
I expect the parameter c
to be the same color as a
and b
, and the parens in Array(String)
to both be same color.
See https://www.sublimetext.com/docs/3/scope_naming.html#entity. entity
scopes are used to populate the symbol list and enable the "Jump to Definition" behavior.
An example:
class Foo
property bar : String
def baz; end
end
foo = Foo.new
foo.baz
foo.bar
Putting the cursor in the word baz
in foo.baz
and then pressing alt+cmnd+down will jump to the definition of baz
on Foo
(or if there are multiple definitions of it, it brings up a palette to jump between definitions).
However, doing the same on bar
does not jump to the definition because there is no actual function definition in the source code.
I think that jumping to property
definitions should be supported, and they use a scope like entity.name.property
instead of entity.name.function
to be semantically accurate.
I know there's some effort to do this with Scry, but it can also just be done with the symbol scoping so why not at least start there. It's not a perfect solution and doesn't address issues with jumping to things defined by macros, but it's a good step towards that and would feel more consistent overall.
{% for s in Asdf %}
def asdf_{
end
}
{% end %}
So when my cursor is after asdf_
and I type the opening curly, the closing curly ends up after the end block...
Unlike Ruby, which just uses a prefix 0
to denote octal literals, Crystal uses 0o
(which I really like). However, this difference is not handled in the current syntax highlighter, meaning octal literals have no scope applied to them, and thus can't be highlighted.
To match other numeric literals, octal literals should get the scope constant.numeric.crystal
.
crystal browser
lets you navigate to methods by clicking on them. It would be amazing if that functionality existed in Sublime.
That's a thing now:
{% verbatim do %}
{% end %}
I'm not sure whether is it a keyword, though
Given this file:
class Foo <
This is what I've got in the console:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 818, in run_
return self.run(edit)
File "crystal_format in /home/faust/.config/sublime-text-3/Installed Packages/sublime-crystal.sublime-package", line 52, in run
File "./python3.3/json/__init__.py", line 316, in loads
File "./python3.3/json/decoder.py", line 351, in decode
File "./python3.3/json/decoder.py", line 369, in raw_decode
ValueError: No JSON object could be decoded
Traceback (most recent call last):
File "./python3.3/json/decoder.py", line 367, in raw_decode
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 818, in run_
return self.run(edit)
... and so on
Basic formatting works, but if there is an error in the code, it's not handled properly - no message is given except these errors in the console.
working on my ubuntu, but not on my osx, sublime v 3, installed via packagecontrol,
this started happening after the patch to fix the popup cmd on save. basically, sometimes when you save your entire code gets cut off in half. i can't reproduce this consistently, it happens out of pure randomness (about 3 times per day). so am not sure how to debug / test it.
but i figured i'd make a issue for the record incase anyone else experiences this.
happens on Windows WSL 10, 64-bit. latest sublime text 3.
edit: iirc, it happened more if the file was > 500 lines of code. it's been happening for the past several months, I just never really made an issue about it cause i just did ctrl+z and got my text back. however, i can't take it anymore
Hey guys, seeing this when I choose Crystal as my language for the current file:
Error loading scope:source.js.jquery: Unable to find syntax file for scope source.js.jquery in Packages/Crystal/Crystal.tmLanguage
Any ideas?
Fotis
It's a keyword now
When applying a block comment, empty lines will not be prefixed with a #
. This will tear the comment blocks apart.
I have no idea how to specify this in preferences/Comments.tmPreferences
followup on #21
This formatting is correct:
require "uuid"
module Foo
proc = ->(x : String) do
puts UUID.new(x)
rescue ArgumentError
puts "Invalid UUID!"
end
proc.call("abc")
end
While the plugin does not think so:
require "uuid"
module Foo
proc = ->(x : String) do
puts UUID.new(x)
rescue ArgumentError
puts "Invalid UUID!"
end
proc.call("abc")
end
When lines are commented using //
, crystal syntax highlighting is still applied to the line. I would suggest that the commented text and the comment operator be highlighted in green.
Is it possible to add auto completion like GoSublime since it is a compiled language?
Or do we need a daemon like gocode? And something for formatting would also be good like gofmt.
This problem causes all features of the plugin to be unavailable.
This problem occurs in 0.27.1 version and higher.
Sublime:
Version 3.1.1, Build 3176
---
Crystal:
Crystal 0.27.1 (2019-02-01)
LLVM: 6.0.1
Default target: x86_64-apple-macosx
Traceback (most recent call last):
File "./python3.3/json/decoder.py", line 367, in raw_decode
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Applications/Sublime.app/Contents/MacOS/sublime_plugin.py", line 1072, in run_
return self.run(edit)
File "/Users/User/Library/Application Support/Sublime Text 3/Installed Packages/Crystal.sublime-package/crystal_format.py", line 62, in run
File "./python3.3/json/__init__.py", line 316, in loads
File "./python3.3/json/decoder.py", line 351, in decode
File "./python3.3/json/decoder.py", line 369, in raw_decode
ValueError: No JSON object could be decoded
If my indentation is tabs or different form 2 spaces saving the file with trailing whitespace will cause it to get converted to two spaces.
Issue on ST3 with the following config:
{
"color_scheme": "Packages/Colorsublime - Themes/Flatland_Black.tmTheme",
"detect_indentation": true,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"font_size": 10,
"hot_exit": false,
"ignored_packages":
[
"Emmet"
],
"remember_open_files": false,
"theme": "Adaptive.sublime-theme",
"trim_trailing_white_space_on_save": true,
"vintage_start_in_command_mode": true,
"vintage_use_clipboard": true
}
I often end up using the word type
in my code for various things. But, it almost always ends up getting highlighted incorrectly for the context in which it's being used.
afaik, the only place where type
is a valid keyword is inside of a lib
definition, or in macros (and even then, it's @type
), so I think the highlighting for the word should be restricted to that context.
As the image above shows, the magic constant __END_LINE__
(introduced in 0.20.0) is not currently being recognized by the syntax definition.
It should be scoped with variable.language.crystal
to match __LINE__
, and __FILE__
.
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.