Skip to content
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

feat: add Ruby grammar #648

Merged
merged 1 commit into from
Dec 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions org.eclipse.tm4e.language_pack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ for the [Eclipse IDE](https://eclipseide.org).
| Python | file-extensions="cpy, gyp, gypi, ipy, py, pyi, pyt, pyw, rpy"<br />file-names="SConscript, SConstruct" | [1.79.0@microsoft/vscode](https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/python) [[upstream]](https://github.com/MagicStack/MagicPython/commit/7d0f2b22a5ad8fccbd7341bc7b7a715169283044)
| R | file-extensions="r, rhistory, rprofile, rt" | [1.79.0@microsoft/vscode](https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/r) [[upstream]](https://github.com/Ikuyadeu/vscode-R/commit/ff60e426f66503f3c9533c7a62a8fd3f9f6c53df)
| reStructuredText | file-extensions="rst" | [1.79.0@microsoft/vscode](https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/restructuredtext) [[upstream]](https://github.com/trond-snekvik/vscode-rst/commit/4f6f1a8f94e0d16e30dddc9c4e359d062b715408)
| Ruby | file-extensions="erb, gemspec, podspec, rake, rb, rbi, rbx, rjs, ru"<br />file-names="appfile, appraisals, berksfile, berksfile.lock, brewfile, capfile, cheffile, dangerfile, deliverfile, fastfile, gemfile, guardfile, gymfile, hobofile, matchfile, podfile, puppetfile, rakefile, rantfile, scanfile, snapfile, thorfile, vagrantfile" | [1.79.0@microsoft/vscode](https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/ruby) [[upstream]](https://github.com/textmate/ruby.tmbundle/commit/efcb8941c701343f1b2e9fb105c678152fea6892)
| Rust <img src="syntaxes/rust/rust.png" width=16/> | file-extensions="rs" | [1.79.0@microsoft/vscode](https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/rust) [[upstream]](https://github.com/dustypomerleau/rust-syntax/commit/20462d50ff97338f42c6b64c3f421c634fd60734)
| SCSS | file-extensions="scss" | [1.79.0@microsoft/vscode](https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/scss) [[upstream]](https://github.com/atom/language-sass/commit/f52ab12f7f9346cc2568129d8c4419bd3d506b47)
| ShaderLab | file-extensions="shader" | [1.79.0@microsoft/vscode](https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/shaderlab) [[upstream]](https://github.com/tgjones/shaders-tmLanguage/commit/c72c8b39380ba5a86c58ceed053b5d965ebf38b3)
Expand Down
5 changes: 5 additions & 0 deletions org.eclipse.tm4e.language_pack/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ <h2>About This Content</h2>
<td>file-extensions="rst"</td>
<td><a href="https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/restructuredtext">1.79.0@microsoft/vscode</a> <a href="https://github.com/trond-snekvik/vscode-rst/commit/4f6f1a8f94e0d16e30dddc9c4e359d062b715408">[upstream]</a>
</tr>
<tr>
<td>Ruby</td>
<td>file-extensions="erb, gemspec, podspec, rake, rb, rbi, rbx, rjs, ru"<br />file-names="appfile, appraisals, berksfile, berksfile.lock, brewfile, capfile, cheffile, dangerfile, deliverfile, fastfile, gemfile, guardfile, gymfile, hobofile, matchfile, podfile, puppetfile, rakefile, rantfile, scanfile, snapfile, thorfile, vagrantfile"</td>
<td><a href="https://github.com/microsoft/vscode/tree/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/extensions/ruby">1.79.0@microsoft/vscode</a> <a href="https://github.com/textmate/ruby.tmbundle/commit/efcb8941c701343f1b2e9fb105c678152fea6892">[upstream]</a>
</tr>
<tr>
<td>Rust <img src="syntaxes/rust/rust.png" width=16/></td>
<td>file-extensions="rs"</td>
Expand Down
20 changes: 20 additions & 0 deletions org.eclipse.tm4e.language_pack/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,26 @@
<languageConfiguration contentTypeId="org.eclipse.tm4e.language_pack.restructuredtext" path="syntaxes/restructuredtext/restructuredtext.language-configuration.json" />
</extension>

<!-- ======================================== -->
<!-- ruby/ruby: Ruby -->
<!-- ======================================== -->
<extension point="org.eclipse.core.contenttype.contentTypes">
<content-type id="org.eclipse.tm4e.language_pack.ruby" name="Ruby" base-type="org.eclipse.tm4e.language_pack.basetype" priority="low"
file-extensions="erb,gemspec,podspec,rake,rb,rbi,rbx,rjs,ru" file-names="appfile,appraisals,berksfile,berksfile.lock,brewfile,capfile,cheffile,dangerfile,deliverfile,fastfile,gemfile,guardfile,gymfile,hobofile,matchfile,podfile,puppetfile,rakefile,rantfile,scanfile,snapfile,thorfile,vagrantfile" />
</extension>
<extension point="org.eclipse.tm4e.registry.grammars">
<grammar scopeName="source.ruby" path="syntaxes/ruby/ruby.tmLanguage.json" />
<scopeNameContentTypeBinding scopeName="source.ruby" contentTypeId="org.eclipse.tm4e.language_pack.ruby" />
</extension>

<extension point="org.eclipse.tm4e.languageconfiguration.languageConfigurations">
<languageConfiguration contentTypeId="org.eclipse.tm4e.language_pack.ruby" path="syntaxes/ruby/ruby.language-configuration.json" />
</extension>

<extension point="org.eclipse.tm4e.ui.snippets">
<snippet name="Ruby Example" path="syntaxes/ruby/ruby.example.rb" scopeName="source.ruby" />
</extension>

<!-- ======================================== -->
<!-- rust/rust: Rust -->
<!-- ======================================== -->
Expand Down
67 changes: 67 additions & 0 deletions org.eclipse.tm4e.language_pack/syntaxes/ruby/ruby.example.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Comments
# This is a comment

# Variables
name = "John"
age = 25

# String interpolation
puts "My name is #{name} and I am #{age} years old."

# Arrays
numbers = [1, 2, 3, 4, 5]

# Iteration
numbers.each do |number|
puts "Number: #{number}"
end

# Hashes
person = { name: "Alice", age: 30, city: "Wonderland" }

# Symbols
key = :name

# Accessing hash values
puts "#{person[key]} lives in #{person[:city]}."

# Conditionals
if age >= 18
puts "I am an adult."
else
puts "I am a minor."
end

# Methods
def greet(name)
puts "Hello, #{name}!"
end

greet("Bob")

# Classes and objects
class Dog
attr_accessor :name, :age

def initialize(name, age)
@name = name
@age = age
end

def bark
puts "Woof!"
end
end

# Create an instance of Dog
my_dog = Dog.new("Buddy", 3)

# Method invocation
my_dog.bark

# Exception handling
begin
result = 10 / 0
rescue ZeroDivisionError => e
puts "Error: #{e.message}"
end
5 changes: 0 additions & 5 deletions org.eclipse.tm4e.language_pack/updater/updater-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,6 @@ sources:
razor:
label: ASP.NET Razor

ruby:
languages:
ruby:
ignored: tm4e fails to parse the grammar

search-result:
ignored: syntax highlighting broken
languages:
Expand Down
39 changes: 39 additions & 0 deletions org.eclipse.tm4e.language_pack/updater/updater-state.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,45 @@ extensions:
path: extensions/ruby
ref: 1.79.0
commit: b380da4ef1ee00e224a15c1d4d9793e27c2b6302
languages:
ruby:
label: Ruby
scope-name: source.ruby
upstream-url: https://github.com/textmate/ruby.tmbundle/commit/efcb8941c701343f1b2e9fb105c678152fea6892
file-extensions:
- .erb
- .gemspec
- .podspec
- .rake
- .rb
- .rbi
- .rbx
- .rjs
- .ru
file-names:
- appfile
- appraisals
- berksfile
- berksfile.lock
- brewfile
- capfile
- cheffile
- dangerfile
- deliverfile
- fastfile
- gemfile
- guardfile
- gymfile
- hobofile
- matchfile
- podfile
- puppetfile
- rakefile
- rantfile
- scanfile
- snapfile
- thorfile
- vagrantfile
rust:
github:
repo: microsoft/vscode
Expand Down
Loading