-
Notifications
You must be signed in to change notification settings - Fork 15
Add snippets #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
andyw8
wants to merge
6
commits into
zed-extensions:main
Choose a base branch
from
andyw8:andyw8/add-snippets
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add snippets #53
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f5ffaca
Add snippets from Ruby LSP
andyw8 61451c5
Configure extension to use snippets
andyw8 87d646e
Add note to license
andyw8 6a728dd
Add snippet for def
andyw8 19715ac
Rename def singleton snippet prefix
andyw8 6eedb6e
Update Ruby LSP attribution
andyw8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ version = "0.4.6" | |
schema_version = 1 | ||
authors = ["Vitaly Slobodin <[email protected]>"] | ||
repository = "https://github.com/zed-extensions/ruby" | ||
snippets = "snippets.json" | ||
|
||
[language_servers.solargraph] | ||
name = "Solargraph" | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
{ | ||
"New Minitest spec": { | ||
"prefix": ["Minitest"], | ||
"body": [ | ||
"# frozen_string_literal: true", | ||
"", | ||
"require \"spec_helper\"", | ||
"", | ||
"class $1 < Minitest::Spec", | ||
" describe \"$2\" do", | ||
" it \"$3\" do", | ||
" $0", | ||
" assert(true)", | ||
" end", | ||
" end", | ||
"end", | ||
"" | ||
], | ||
"description": "New Minitest class using the spec syntax." | ||
}, | ||
"New Minitest test": { | ||
"prefix": ["Minitest"], | ||
"body": [ | ||
"# frozen_string_literal: true", | ||
"", | ||
"require \"test_helper\"", | ||
"", | ||
"class $1 < Minitest::Test", | ||
" def test_$2", | ||
" $0", | ||
" assert(true)", | ||
" end", | ||
"end", | ||
"" | ||
], | ||
"description": "New Minitest class using the test syntax." | ||
}, | ||
"New Rspec test": { | ||
"prefix": ["Rspec"], | ||
"body": [ | ||
"# frozen_string_literal: true", | ||
"", | ||
"describe $1 do", | ||
" describe \"$2\" do", | ||
" it \"$3\" do", | ||
" $0", | ||
" expect(true).to eq(true)", | ||
" end", | ||
" end", | ||
"end", | ||
"" | ||
], | ||
"description": "New Minitest class using the spec syntax." | ||
}, | ||
"New class": { | ||
"prefix": ["class"], | ||
"body": ["class $1", " def initialize", " $0", " end", "end", ""], | ||
"description": "New Ruby class." | ||
}, | ||
"New module": { | ||
"prefix": ["module"], | ||
"body": ["module $1", " def $2", " $0", " end", "end", ""], | ||
"description": "New Ruby module." | ||
}, | ||
"Begin rescue block": { | ||
"prefix": ["begin"], | ||
"body": ["begin", " $0", "rescue $1", "end", ""], | ||
"description": "New Ruby begin block with rescue." | ||
}, | ||
"Begin rescue ensure": { | ||
"prefix": ["begin"], | ||
"body": ["begin", " $0", "rescue $1", "ensure", "end", ""], | ||
"description": "New Ruby begin block with rescue and ensure." | ||
}, | ||
"Each inline": { | ||
"prefix": ["each"], | ||
"body": ["each { |$1| $0 }"], | ||
"description": "New Ruby inline each loop." | ||
}, | ||
"Each block": { | ||
"prefix": ["each"], | ||
"body": ["each do |$1|", " $0", "end"], | ||
"description": "New Ruby each loop." | ||
}, | ||
"Map inline": { | ||
"prefix": ["map"], | ||
"body": ["map { |$1| $0 }"], | ||
"description": "New Ruby inline map loop." | ||
}, | ||
"Map block": { | ||
"prefix": ["map"], | ||
"body": ["map do |$1|", " $0", "end"], | ||
"description": "New Ruby map loop." | ||
}, | ||
"Flat map inline": { | ||
"prefix": ["flat_map"], | ||
"body": ["flat_map { |$1| $0 }"], | ||
"description": "New Ruby inline flat_map loop." | ||
}, | ||
"Flat Map block": { | ||
"prefix": ["flat_map"], | ||
"body": ["flat_map do |$1|", " $0", "end"], | ||
"description": "New Ruby flat_map loop." | ||
}, | ||
"Select inline": { | ||
"prefix": ["select"], | ||
"body": ["select { |$1| $0 }"], | ||
"description": "New Ruby inline select loop." | ||
}, | ||
"Select block": { | ||
"prefix": ["select"], | ||
"body": ["select do |$1|", " $0", "end"], | ||
"description": "New Ruby select loop." | ||
}, | ||
"Find inline": { | ||
"prefix": ["find"], | ||
"body": ["find { |$1| $0 }"], | ||
"description": "New Ruby inline find loop." | ||
}, | ||
"Find block": { | ||
"prefix": ["find"], | ||
"body": ["find do |$1|", " $0", "end"], | ||
"description": "New Ruby find loop." | ||
}, | ||
"Define method method": { | ||
"prefix": ["def"], | ||
"body": ["def $1", " $0", "end"], | ||
"description": "New method." | ||
}, | ||
"Define singleton method": { | ||
"prefix": ["defs"], | ||
"body": ["def self.$1", " $0", "end"], | ||
"description": "New singleton method." | ||
}, | ||
"Define attribute accessor": { | ||
"prefix": ["attr"], | ||
"body": ["attr_accessor :$1"], | ||
"description": "New attribute accessor." | ||
}, | ||
"Define attribute reader": { | ||
"prefix": ["attr"], | ||
"body": ["attr_reader :$1"], | ||
"description": "New attribute reader." | ||
}, | ||
"Define attribute writer": { | ||
"prefix": ["attr"], | ||
"body": ["attr_writer :$1"], | ||
"description": "New attribute writer." | ||
}, | ||
"If else": { | ||
"prefix": ["if"], | ||
"body": ["if $1", " $0", "else", "end"], | ||
"description": "New if statement with else." | ||
}, | ||
"If elsif": { | ||
"prefix": ["if"], | ||
"body": ["if $1", " $0", "elsif $2", " $0", "end"], | ||
"description": "New if statement with elsif." | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.