Giter VIP home page Giter VIP logo

vscode-crystal-lang's People

Contributors

andraantariksa avatar asterite avatar bcardiff avatar dependabot[bot] avatar devnote-dev avatar fabon-f avatar faustinoaq avatar fgimian avatar gitter-badger avatar grkek avatar hertzdevil avatar icyleaf avatar jonnyynnoj avatar joseafga avatar kachick avatar laginha87 avatar lmatayoshi avatar lostintangent avatar makenowjust avatar matheusrich avatar maxberty avatar nobodywasishere avatar oprypin avatar panissupraomnia avatar refi64 avatar respitesage avatar rx14 avatar shalokshalom avatar straight-shoota avatar whereisx 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

vscode-crystal-lang's Issues

use VSCode 1.28.1 debugging it, Error: Command failed: crystal env

VSCode version: 1.28.2

vscode-crystal-lang branch: master

OS๏ผšOSX 10.13.4

vscrystal

cause the below code

const CRENV = Object.create(process.env)

when i use

const CRENV = Object.create({ ...process.env })

it will be ok, now i don't know why, cause when i try above code in NODE, it's ok. who can help me?

I love crystal!!! I create a pr even though I don't know whyใ€‚I want to contribute to the crystal's community.

Manual how to use with scry?

I cloned scry repo, build scry executable from src/scry and wrote path to this executable in settings (for scry binary)

But it seems that server does not work.

Am I doing it wrong?

Support crystal tools format

I have instaled crystal 0.26 but it does not support crystal formatting built in tool, I have it but it is not working

Error requiring stdlib

macOS 10.14.1 (18B75)

crystal env
CRYSTAL_CACHE_DIR="/Users/anders/.cache/crystal"
CRYSTAL_PATH="/usr/local/Cellar/crystal/0.27.0/src:lib"
CRYSTAL_VERSION="0.27.0"
code --version
1.29.1
bc24f98b5f70467bc689abf41cc5550ca637088e
x64
which crystal
/usr/local/bin/crystal
crystal -v
Crystal 0.27.0 (2018-11-04)

LLVM: 6.0.1
Default target: x86_64-apple-macosx

Settings:

    "crystal-lang.compiler": "/usr/local/bin/crystal",
    "crystal-lang.hover": true,
    "crystal-lang.implementations": true,
    "crystal-lang.logLevel": "warn",
    "crystal-lang.problems": "build",

Error:

while requiring "prelude": can't find file 'prelude'

If you're trying to require a shard:
- Did you remember to run `shards install`?
- Did you make sure you're running the compiler in the same directory as your shard.yml?```

Add "endwise" functionality?

There's a package endwise on the VSCode marketplace that automatically adds an end to every block. Should this functionality also be implemented within this plugin?

Extra indentation of def when prefixed with "private"

When I type

private def foo

And then press Enter, and then type an end, the plugin dedents the end once, so I get this:

  private def foo
end

This also occurs with prefixes of protected, and cases:

  case foo
when

Code diagnostic is not working

  • Extension Name: vscode-crystal-lang
  • Extension Version: 0.3.9
  • OS Version: Linux x64 4.14.16-1-MANJARO
  • VSCode version: 1.20.0
  • Crystal version: 0.24.1

Currently vscode-crystal-lang doesn't detect problems neither syntax or build

vokoscreen-2018-02-07_22-53-28

Keep getting "Crystal compiler not found. spawn crystal ENOENT" errors.

Hi. I have Bash on Windows, Crystal and https://github.com/faustinoaq/crystal-windows-installer installed.

My relevant VSCode settings are

{
    "crystal-lang.hover": true,
    "crystal-lang.implementations": true,
    "crystal-lang.completion": true,
    "crystal-lang.bashOnWindows": true
}

Everything seems to work as expected however I keep getting Crystal compiler not found. spawn crystal ENOENT errors. Is there another setting hiding somewhere that needs to be tweaked?

Keyword `out` is not highlighted

out is a keyword used for C bindings, when a variable is passed to a function and then its value is filled. It currently isn't supported in VSCode Crystal:

screen shot 2018-03-29 at 6 19 28 pm

def size : Tuple(Int32, Int32)
  UI.window_content_size(to_unsafe, out width, out height)
end

In the above example, the out should be highlighted.

why vscode update my crystal lang extension without my permission?

now all the variables inside my methods are light blue, not white

i do not like this and never asked vscode to update to the latest version :/

is it possible for me to change this? i mean everything was working just fine for nearly a year, it was perfect! ๐Ÿ˜ฟ ๐Ÿ˜ญ

Replace json syntax files by tmLanguage used on Sublime Text package

Hi community, I have ben busy latest weeks, I hope I can pull some commits this weekend

I'm maintaining the crystal-syntax.json file responsible of syntax highlighting, but there is some issues I don't really know how to fix, so I think if VSCode have out-the-box support for .tmLanguage then would be a nice idea to use it

screenshot_20180406_122031

I think it would be easier to maintain both, sublime-text and VSCode highlighting, since both will use the same file.

I don't know if atom can use tmLanguage files as well, @keplersj Do you know something about this? ๐Ÿ˜…

Where is compiler path?

I am using Linux Debian on Windows WSL.
I use VS Code and have got crystal, dependencies and LLVM compiler installed, it works on the flagship, Hello World!.

I have now installed this extension, but cant figure out where the compiler path goes for the llvm.
I put in the example, "crystal-lang.compiler": "/usr/bin/crystal/bin", clearly this is not the compiler path...

Since the wsl kind of discreetly hides everything, as we are not allowed to modify any files in the system. A file search hasn't really help me locate it.

Thanks

undefined constant Lucky::Env

I just started with Crystal (coming from Ruby) and spun up a new Lucky app. I don't think I've changed anything yet. But when I open my database.cr file, I'm getting this error reported in VSCode:

undefined constant Lucky::Env

I think this is just showing up in VSCode, because when I start the project up, it runs fine. That said, I'm not 100% sure if this is the right project to report this issue for. Let me know if I need to open an issue somewhere else.

Add indentation support for `abstract` keyword

Reproduction:

  1. Type this into a .cr file in VS Code:

    abstract class Foo
  2. Press Enter, and then type

    end

Results:

  abstract class Foo
end

The end is dedented once, as if the abstract nullifies the indentation of class.

Scry crashes if workspace not loaded with .cr file

Scry will work if the workspace is opened with a crystal file in the editor already, but if there is no file in the editor or it is not a crystal file, scry will crash once a crystal file is opened and this extension loads. I can not get the error message from the scry process. This failure happens with both master and the release of this extension and using the master branch of scry. This is probably an issue in scry but I came here first to try to get an idea of what kind of error is happening.

Suggest: ignore path with scry server

I installed local-history extension and enable scry, it always display error anytime with files in ${workspaceFolder}/.history/ path.

while requiring "../config/*": can't find file '../config/*' relative to '/Users/icyleaf/crystal/amber_blog/.history/src'

cr file:

require "../config/*"

Amber::Server.start

May add a new setting to ignore path or ignore in code?

Code Formatting behave strangely

After upgrading crystal language to 0.27.1 and 0.27.2, code formatting replace all the entire code in a file with "Error: Invalid option: -f".

Testing new profiling feature

  • Extension Name: crystal-lang
  • Extension Version: 0.3.9
  • OS Version: Linux x64 4.14.14-1-MANJARO
  • VSCode version: 1.19.0

We have written the needed data into your clipboard. Please paste:

{
	"activationTimes": {
		"startup": false,
		"codeLoadingTime": 263,
		"activateCallTime": 2,
		"activateResolvedTime": 3,
		"activationEvent": "onLanguage:crystal"
	}
}

Whole buffer replaced with syntax error

In this installation:

code --version
1.31.0
7c66f58312b48ed8ca4e387ebd9ffe9605332caa
x64
crystal-lang: 0.3.12

The entire buffer is replaced with any syntax error.

E.g.

my_method(
Syntax error in line 1: expecting token ')', not 'end'

scry shows error but seems that autocompletion fails

Hi...good day, first thank you for this project and scry, seems really promising, my issue is that seems scry can find the issues in my code but if I try autocomplete not show any completition

my config is

"crystal-lang.compiler": "/home/yo/.crenv/shims/crystal",
"crystal-lang.problems": "build",
"crystal-lang.completion": true,
"crystal-lang.server": "/usr/bin/scry",
"crystal-ide.backend": "custom",
"crystal-ide.customCommand": "/usr/bin/scry",
"crystal-lang.hover": true

if I change in amber a code like this

pets = Pet.all
#change to
pets=Pet.allx #show error [Scry] undefined method 'allx' for Pet:Class great!!

#now...if I press ctr+space when I'm in the l letter
pets=Pet.al| 
#scry completes with ApplicationController...which is not ok

would be possible fix the autocomplete system??? thank you so much!!!

[suggestion] possible indentation with when blocks

hello @faustinoaq and others, long time no see!

i just noticed this because the code looks so out of place compared to everything else that is indented lol

but i made a screenshot to show the comparison
image

for example, we have loop do and if xxxx all indented. but when it comes to when inside a case, it just is perfectly below it. looks out of place imo, and the new indendation is far easier to read the code as well.

this is just personsl preference, not a language suggestion at all! so i'm wondering if maybe there could be an option in the vscode settings to enable this! thanks for reading!

Crystal compiler not found. Some features can throw errors.

Description

I tested all possible paths (e.g. default, which, brew, #33).
But still shows that the compiler path was not found.
I tested some crystal versions (e.g. 0.27.0, 0.27.1, 0.27.2).
Crystal compiler not found related issues: #19 #33 #62 #63.

Already Tested

  • Default
Just the default.
{
	"crystal-lang.compiler": "crystal"
}
  • Which
iMac:~ User$ which crystal
/usr/local/bin/crystal
{
	"crystal-lang.compiler": "/usr/local/bin/crystal"
}
  • HomeBrew
/usr/local/Cellar/crystal/0.27.2 (957 files, 50.3MB) *
  Poured from bottle on 2019-02-08 at 01:13:58
{
	"crystal-lang.compiler": "/usr/local/Cellar/crystal/0.27.2/bin/crystal"
}
  • Issue
faustinoaq #33
{
	"crystal-lang.compiler": "/usr/local/Cellar/crystal/0.27.2/src/compiler/crystal"
}

Version Info

Vs Code:
  Version 1.30.2 (1.30.2)
  61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8
  2019-01-07T22:42:11.005Z

Crystal:
  Crystal 0.27.2 (2019-02-05)
  LLVM: 6.0.1
  Default target: x86_64-apple-macosx

macOS:
  macOS 10.12.6 (16G29)

Marketplace:
  This Plugin: 0.3.14

Crystal Environment

iMac:compiler User$ crystal env
CRYSTAL_CACHE_DIR="/Users/User/.cache/crystal"
CRYSTAL_PATH="/usr/local/Cellar/crystal/0.27.2/src:lib"
CRYSTAL_VERSION="0.27.2"

HomeBrew Info

crystal: stable 0.27.2 (bottled), HEAD
Fast and statically typed, compiled language with Ruby-like syntax
https://crystal-lang.org/
/usr/local/Cellar/crystal/0.27.2 (957 files, 50.3MB) *
  Poured from bottle on 2019-02-08 at 01:13:58
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/crystal.rb
==> Dependencies
Build: libatomic_ops โœ”
Required: bdw-gc โœ”, gmp โœ”, libevent โœ”, libyaml โœ”, llvm@6 โœ”, pcre โœ”, pkg-config โœ”
==> Options
--HEAD
	Install HEAD version
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions

Console Log

/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:303 [Extension Host] Error: Command failed: crystal env
	at checkExecSyncError (child_process.js:613:13)
	at Object.execSync (child_process.js:653:13)
	at Object.execSync (ELECTRON_ASAR.js:721:23)
	at STDLIB (/Users/User/.vscode/extensions/faustinoaq.crystal-lang-0.3.14/out/src/crystalUtils.js:32:38)
	at Object.<anonymous> (/Users/User/.vscode/extensions/faustinoaq.crystal-lang-0.3.14/out/src/crystalUtils.js:44:3)
	at Object.<anonymous> (/Users/User/.vscode/extensions/faustinoaq.crystal-lang-0.3.14/out/src/crystalUtils.js:333:3)
	at Module.t._initNodeRequire.r._compile (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:15:963)
	at Object.Module._extensions..js (module.js:653:10)
	at Module.load (module.js:561:32)
	at tryModuleLoad (module.js:504:12)
	at Function.Module._load (module.js:496:3)
	at Function.t._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:767:268)
	at Function.t.getExtensionPathIndex.then.s._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:749:538)
	at Function.t.getExtensionPathIndex.then.r._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:692:883)
	at Module.require (module.js:586:17)
	at n (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:15:738)
	at Object.<anonymous> (/Users/User/.vscode/extensions/faustinoaq.crystal-lang-0.3.14/out/src/crystalMain.js:14:24)
	at Object.<anonymous> (/Users/User/.vscode/extensions/faustinoaq.crystal-lang-0.3.14/out/src/crystalMain.js:78:3)
	at Module.t._initNodeRequire.r._compile (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:15:963)
	at Object.Module._extensions..js (module.js:653:10)
	at Module.load (module.js:561:32)
	at tryModuleLoad (module.js:504:12)
	at Function.Module._load (module.js:496:3)
	at Function.t._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:767:268)
	at Function.t.getExtensionPathIndex.then.s._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:749:538)
	at Function.t.getExtensionPathIndex.then.r._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:692:883)
	at Module.require (module.js:586:17)
	at require (internal/module.js:11:18)
	at Function.i [as __$__nodeRequire] (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:31:146)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:757:987
	at t._doActivateExtension (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:758:80)
	at t._activateExtension (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:756:785)
	at Object.actualActivateExtension (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:754:119)
	at e._activateExtension (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:344:190)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:343:782
	at Array.map (<anonymous>)
	at e._activateExtensions (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:343:757)
	at e.activateByEvent (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:342:14)
	at t._activateByEvent (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:755:255)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:763:584
	at <anonymous>

Screenshot

Why do we need crystal-windows-installer when WSL can be enabled by changing one line?

You mention here in the wiki that in order to use WSL with this extension we need to install the crystal-windows-installer package (which requires WSL to work anyway), but I've found that isn't the case at all.

If shell: "bash" is added to spawnOptions in this file then it magically starts working through WSL.

I've posted this as a question instead of just submitting a PR because I have zero experience with extension development and there may well be a valid reason for not doing it this way. Is there?

"Array(Int32)" in argument highlighted incorrectly

def next_step(cells : Array(Int32))
  new_cells = [] of Int32
  
  (0...cells.size).each do |index|
    current_cell = cells[index]
    next_cell = cells[(index + 1) % cells.size]

    current_cell = (current_cell + next_cell) % 3
    new_cells.push(current_cell)
  end

  return new_cells
end

The left bracket in Array(Int32) is highlighted incorrectly:

screen shot 2017-07-29 at 3 11 07 pm

Crystal compiler not found. Some features can throw errors

I have installed crystal with homebrew and the compiler is in the path below:
/usr/local/Cellar/crystal-lang/0.23.1_3/src/compiler/crystal

But keep getting the this error:
Crystal compiler not found. Some features can throw errors

Add support for annotations

This PR introduced user-defined annotations. Right now it's legal to write something like that:

annotation Foo
end

However vscode-crystal-lang implementation doesn't cover that. For example there is no syntax highlighting or anything else that may be required (it's not supported even on github).

Problem with syntax highlighting

As it's easy to see in the screenshot, word type has wrong colour. It's treated as if it were a keyword, not a regular variable/parameter name.

invalid_hightlighting

Shortcut to navigate to beginning and end of block

Hi, I am very new to Crystal and I have been barely using it for a week on vs code with this extension.

Good work guys! I would like to suggest some features.

In programming languages, where brackets are used to define the scope, I use cmd+shift+\ to navigate to the matching bracket.

go-end-of-block

But in crystal, we don't have brackets and scopes are being defined by def, if ... end etc. So, I would like to have shortcuts to move to beginning and end of scopes.

image

For example,

  • If the shortcut is pressed at line number 30, the cursor would navigate to the end statement at line number 35.
  • If the shortcut is pressed at line number 32 ( if statement ), the cursor would navigate to the end statement at line number 34.
  • If the shortcut is pressed at line number 31, the cursor would navigate to the end statement at line number 35. ( because that code is in do-end block ) -- This is not possible with cmd+shift+\ in bracket scoped languages. So, this could be optional implementation based on the possibilities.

This is will help in navigating the code base faster. It's as powerful as saying "Go to the next function in the class and modify it. Once done, move to the next function."

Add support for Jump to Definition

I'm loving the plugin so far. It would be wonderful if it could also support Jump to Definition so I could jump to a class or method definition in the project.

Thanks for the project, and thanks for considering this feature.

Add support functions to syntax highlighting

See Ruby's highlighting for more details.

Built-in functions in Crystal for objects and such, like .not_nil! and push, should be highlighted using support.function.core.crystal.

This can't be directly copied and pasted, since there is a sizeable difference between the two languages in terms of built-in functions.

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.