Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Commit

Permalink
Update 0.25.1 (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmulvihill committed Aug 11, 2018
1 parent 7ea71f9 commit 211c910
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
@@ -1,4 +1,4 @@
FROM crystallang/crystal:0.24.1
FROM crystallang/crystal:0.25.1

RUN apt-get update
RUN apt-get clean
Expand Down
8 changes: 4 additions & 4 deletions spec/scry/completion_provider_spec.cr
@@ -1,7 +1,7 @@
require "../spec_helper"

module Scry
BOOLEAN_METHODS = %w(!= & == ^ clone hash to_json to_s to_s to_yaml |)
BOOLEAN_METHODS = %w(!= & == ^ clone hash to_json to_s to_s to_unsafe to_yaml |)
INT32_METHODS = %w(- clone popcount)

private macro it_completes(code, with_labels = nil)
Expand Down Expand Up @@ -60,7 +60,7 @@ module Scry
a."

it_completes("a = true
a.to_", %w(to_json to_s to_s to_yaml))
a.to_", %w(to_json to_s to_s to_unsafe to_yaml))
end

context "int32" do
Expand Down Expand Up @@ -140,8 +140,8 @@ module Scry
it_completes(" ::", %w())
it_completes("JSON::P", %w(ParseException Parser PullParser))
it_completes("JSON::Pa", %w(ParseException Parser))
it_completes("JSON::", %w(Any Builder Error Lexer Lexer::IOBased Lexer::StringBased ParseException Parser PullParser Token))
it_completes("JSO", %w(JSON JSON::Any JSON::Builder JSON::Error JSON::Lexer JSON::Lexer::IOBased JSON::Lexer::StringBased JSON::ParseException JSON::Parser JSON::PullParser JSON::Token))
it_completes("JSON::", %w(Any Builder Error Lexer Lexer::IOBased Lexer::StringBased MappingError ParseException Parser PullParser Serializable Serializable::Strict Serializable::Unmapped Token))
it_completes("JSO", %w(JSON JSON::Any JSON::Builder JSON::Error JSON::Lexer JSON::Lexer::IOBased JSON::Lexer::StringBased JSON::MappingError JSON::ParseException JSON::Parser JSON::PullParser JSON::Serializable JSON::Serializable::Strict JSON::Serializable::Unmapped JSON::Token))
end
end
end
2 changes: 1 addition & 1 deletion spec/spec_helper.cr
Expand Up @@ -9,7 +9,7 @@ module Scry

INITIALIZATION_EXAMPLE = %({ "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "processId": 1, "rootPath": "#{ROOT_PATH}", "capabilities": {} , "trace": "off"}})

CONFIG_CHANGE_EXAMPLE = %({"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"crystal":{"maxNumberOfProblems":100,"backend":"scry","customCommand":"crystal","customCommandArgs":[],"logLevel":"debug"}}}})
CONFIG_CHANGE_EXAMPLE = %({"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"crystal-lang":{"maxNumberOfProblems":100,"backend":"scry","customCommand":"crystal","customCommandArgs":[],"logLevel":"debug"}}}})

DOC_OPEN_EXAMPLE = %({"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file://#{SOME_FILE_PATH}","languageId":"crystal","version":1,"text":"put \\"hello\\"; Thing.new"}}})

Expand Down
42 changes: 30 additions & 12 deletions src/scry/protocol/settings.cr
@@ -1,19 +1,37 @@
require "json"

module Scry
struct Settings
JSON.mapping({
crystal_config: {type: Customizations, key: /^crystal.*/, default: Customizations.from_json("{}")},
})
end
alias Settings = SettingsCrystalIDE | SettingsCrystalLang

struct Customizations
JSON.mapping({
max_number_of_problems: {type: Int32, key: "maxNumberOfProblems", default: 100},
backend: {type: String, default: "scry"},
custom_command: {type: String, key: "customCommand", default: "scry"},
custom_command_args: {type: Array(String), key: "customCommandArgs", default: [] of String},
log_level: {type: String, key: "logLevel", default: "info"},
})
include JSON::Serializable
@[JSON::Field(key: "maxNumberOfProblems")]
property max_number_of_problems : Int32 = 100
@[JSON::Field(key: "scry")]
property backend : String = "scry"
@[JSON::Field(key: "customCommand")]
property custom_command : String = "scry"
@[JSON::Field(key: "customCommandArgs")]
property custom_command_args : Array(String) = [] of String
@[JSON::Field(key: "logLevel")]
property log_level : String = "info"
end

# Configuration for vscode-crystal-ide
# https://github.com/kofno/crystal-ide
struct SettingsCrystalIDE
include JSON::Serializable

@[JSON::Field(key: "crystal-ide")]
property crystal_config : Customizations
end

# Configuration for vscode-crystal-lang
# https://github.com/faustinoaq/vscode-crystal-lang
struct SettingsCrystalLang
include JSON::Serializable

@[JSON::Field(key: "crystal-lang")]
property crystal_config : Customizations
end
end
6 changes: 3 additions & 3 deletions src/scry/publish_diagnostic.cr
Expand Up @@ -51,9 +51,9 @@ module Scry
.group_by(&.uri)
.select { |file, diagnostics| !file.ends_with?(".scry_main.cr") }
.map do |file, diagnostics|
ALL_FILES_WITH_DIAGNOSTIC[@uri] << file
unclean(file, diagnostics)
end
ALL_FILES_WITH_DIAGNOSTIC[@uri] << file
unclean(file, diagnostics)
end
end
end
end

0 comments on commit 211c910

Please sign in to comment.