-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinclude.md.html
48 lines (48 loc) · 19.8 KB
/
include.md.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<h2 id="about">About</h2>
<p>RSense is a tool for doing static analysis of Ruby source code. Rsense is used in conjunction with an editor plugin.</p>
<p>RSense is currently under heavy development and ready for testing. Currently we need to improve the homepage and develop plugins for code_completion. In the near future we'll also be ready to implement some of the other basic features like <code>find-definition</code>. After that, there's plenty to do in the long term. See the waffle link below to find out where you can pitch in. It would be awesome if you helped get things done.</p>
<p><img src="https://cloud.githubusercontent.com/assets/1395968/3344028/5b3c2f0a-f8a6-11e3-8952-c0f7155cb19e.gif" alt="Rsense in Atom editor"></p>
<h2 id="installation">Installation</h2>
<p>Add this line to your application's Gemfile:</p>
<pre class="editor-colors"><code>gem 'rsense'
</code></pre><p>And then execute:</p>
<pre class="editor-colors"><code>$ bundle
</code></pre><p>Or install it yourself as:</p>
<pre class="editor-colors"><code>$ gem install rsense
</code></pre><h2 id="usage">Usage</h2>
<p>Install one of these plugins:</p>
<ul>
<li><a href="https://atom.io/packages/rsense">rsense/atom-rsense</a></li>
</ul>
<p>The Rsense server is started from the commandline with:</p>
<pre class="editor-colors"><code>$ rsense start
</code></pre><p>It takes two potential options: <code>--port</code> and <code>--path</code>.</p>
<p>Currently only the Atom plugin is available, but a Sublime Text plugin will follow shortly. After that, if the community has not already contributed Vim and Emacs plugins, we will do so.</p>
<p><strong>When using Rsense, please be patient. After starting the server and triggering the initial completion, Rsense can be slow to load your projects dependencies into it's graph. It's quite fast after this initial completion and in the future we will optimize this.</strong></p>
<h2 id="plugin-authors">Plugin Authors</h2>
<p>Rsense plugins are easy to implement. First your plugin may want to ensure the Rsense server has been started. It can do this by shelling out to the command line with <code>rsense start</code>. Alternately, you can instruct your users to start it from the command line. The server can optionally take a port number like this: <code>rsense start --port 12345</code>. The default port is <code>47367</code>. It also takes a project path, in case the user has a <code>.rsense</code> config file there. For now, this config file is not very useful, but it may become so in the future.</p>
<p>The rsense server will be running at <code>http://localhost:47367</code> (or an alternate port if you specify one). It communicates via json. You need to send it json like the following example:</p>
<pre class="editor-colors"><code class="lang-json"><div><span class="source json"><span class="meta structure dictionary json"><span class="punctuation definition dictionary begin json">{</span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>command<span class="punctuation definition string end json">"</span></span><span class="meta structure dictionary value json"><span class="punctuation separator dictionary key-value json">:</span> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>code_completion<span class="punctuation definition string end json">"</span></span><span class="punctuation separator dictionary pair json">,</span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>project<span class="punctuation definition string end json">"</span></span><span class="meta structure dictionary value json"><span class="punctuation separator dictionary key-value json">:</span> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>spec/fixtures/test_gem<span class="punctuation definition string end json">"</span></span><span class="punctuation separator dictionary pair json">,</span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>file<span class="punctuation definition string end json">"</span></span><span class="meta structure dictionary value json"><span class="punctuation separator dictionary key-value json">:</span> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>spec/fixtures/test_gem/lib/sample.rb<span class="punctuation definition string end json">"</span></span><span class="punctuation separator dictionary pair json">,</span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>code<span class="punctuation definition string end json">"</span></span><span class="meta structure dictionary value json"><span class="punctuation separator dictionary key-value json">:</span> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>require <span class="constant character escape json">\"</span>sample/version<span class="constant character escape json">\"\n\n</span>module Sample<span class="constant character escape json">\n</span> class Sample<span class="constant character escape json">\n</span> attr_accessor :simple<span class="constant character escape json">\n\n</span> def initialize<span class="constant character escape json">\n</span> @simple = <span class="constant character escape json">\"</span>simple<span class="constant character escape json">\"\n</span> end<span class="constant character escape json">\n\n</span> def another<span class="constant character escape json">\n</span> <span class="constant character escape json">\"</span>another<span class="constant character escape json">\"\n</span> end<span class="constant character escape json">\n</span> end<span class="constant character escape json">\n</span>end<span class="constant character escape json">\n\n</span>sample = Sample::Sample.new<span class="constant character escape json">\n</span>sample<span class="punctuation definition string end json">"</span></span><span class="punctuation separator dictionary pair json">,</span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>location<span class="punctuation definition string end json">"</span></span><span class="meta structure dictionary value json"><span class="punctuation separator dictionary key-value json">:</span> <span class="meta structure dictionary json"><span class="punctuation definition dictionary begin json">{</span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"><span class="meta structure dictionary json"> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>row<span class="punctuation definition string end json">"</span></span><span class="meta structure dictionary value json"><span class="punctuation separator dictionary key-value json">:</span> <span class="constant numeric json">18</span><span class="punctuation separator dictionary pair json">,</span></span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"><span class="meta structure dictionary json"> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>column<span class="punctuation definition string end json">"</span></span><span class="meta structure dictionary value json"><span class="punctuation separator dictionary key-value json">:</span> <span class="constant numeric json">7</span></span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"> </span><span class="punctuation definition dictionary end json">}</span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="punctuation definition dictionary end json">}</span></span></span></div></code></pre>
<p>For now, <code>code_completion</code> is the only command available, but this will change in the future. Project is the root dir of the user's project. This is needed for finding information about project dependencies. Code is the text from the file where a completion is being triggered. Location should be obvious.</p>
<p>Rsense will return json that looks like the below:</p>
<pre class="editor-colors"><code class="lang-json"><div><span class="source json"><span class="meta structure dictionary json"><span class="punctuation definition dictionary begin json">{</span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>completions<span class="punctuation definition string end json">"</span></span><span class="meta structure dictionary value json"><span class="punctuation separator dictionary key-value json">:</span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"> <span class="meta structure array json"><span class="punctuation definition array begin json">[</span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"><span class="meta structure array json"> <span class="meta structure dictionary json"><span class="punctuation definition dictionary begin json">{</span></span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"><span class="meta structure array json"><span class="meta structure dictionary json"> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>name<span class="punctuation definition string end json">"</span></span><span class="meta structure dictionary value json"><span class="punctuation separator dictionary key-value json">:</span><span class="string quoted double json"><span class="punctuation definition string begin json">"</span>taint<span class="punctuation definition string end json">"</span></span><span class="punctuation separator dictionary pair json">,</span></span></span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"><span class="meta structure array json"><span class="meta structure dictionary json"> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>qualified_name<span class="punctuation definition string end json">"</span></span><span class="meta structure dictionary value json"><span class="punctuation separator dictionary key-value json">:</span><span class="string quoted double json"><span class="punctuation definition string begin json">"</span>Object#taint<span class="punctuation definition string end json">"</span></span><span class="punctuation separator dictionary pair json">,</span></span></span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"><span class="meta structure array json"><span class="meta structure dictionary json"> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>base_name<span class="punctuation definition string end json">"</span></span><span class="meta structure dictionary value json"><span class="punctuation separator dictionary key-value json">:</span><span class="string quoted double json"><span class="punctuation definition string begin json">"</span>Object<span class="punctuation definition string end json">"</span></span><span class="punctuation separator dictionary pair json">,</span></span></span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"><span class="meta structure array json"><span class="meta structure dictionary json"> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>kind<span class="punctuation definition string end json">"</span></span><span class="meta structure dictionary value json"><span class="punctuation separator dictionary key-value json">:</span><span class="string quoted double json"><span class="punctuation definition string begin json">"</span>METHOD<span class="punctuation definition string end json">"</span></span></span></span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"><span class="meta structure array json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"> </span><span class="punctuation definition dictionary end json">}</span></span><span class="punctuation separator array json">,</span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"><span class="meta structure array json"> <span class="meta structure dictionary json"><span class="punctuation definition dictionary begin json">{</span></span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"><span class="meta structure array json"><span class="meta structure dictionary json"> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>name<span class="punctuation definition string end json">"</span></span><span class="meta structure dictionary value json"><span class="punctuation separator dictionary key-value json">:</span><span class="string quoted double json"><span class="punctuation definition string begin json">"</span>methods<span class="punctuation definition string end json">"</span></span><span class="punctuation separator dictionary pair json">,</span></span></span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"><span class="meta structure array json"><span class="meta structure dictionary json"> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>qualified_name<span class="punctuation definition string end json">"</span></span><span class="meta structure dictionary value json"><span class="punctuation separator dictionary key-value json">:</span><span class="string quoted double json"><span class="punctuation definition string begin json">"</span>Object#methods<span class="punctuation definition string end json">"</span></span><span class="punctuation separator dictionary pair json">,</span></span></span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"><span class="meta structure array json"><span class="meta structure dictionary json"> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>base_name<span class="punctuation definition string end json">"</span></span><span class="meta structure dictionary value json"><span class="punctuation separator dictionary key-value json">:</span><span class="string quoted double json"><span class="punctuation definition string begin json">"</span>Object<span class="punctuation definition string end json">"</span></span><span class="punctuation separator dictionary pair json">,</span></span></span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"><span class="meta structure array json"><span class="meta structure dictionary json"> <span class="string quoted double json"><span class="punctuation definition string begin json">"</span>kind<span class="punctuation definition string end json">"</span></span><span class="meta structure dictionary value json"><span class="punctuation separator dictionary key-value json">:</span><span class="string quoted double json"><span class="punctuation definition string begin json">"</span>METHOD<span class="punctuation definition string end json">"</span></span></span></span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"><span class="meta structure array json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"> </span><span class="punctuation definition dictionary end json">}</span></span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="meta structure dictionary value json"><span class="meta structure array json"> <span class="punctuation definition array end json">]</span></span></span></span></span></div><div><span class="source json"><span class="meta structure dictionary json"><span class="punctuation definition dictionary end json">}</span></span></span></div></code></pre>
<h2 id="contributing">Contributing</h2>
<p>Contributions can only be accepted if they include tests.</p>
<ol>
<li>Fork it ( <a href="https://github.com/[my-github-username]/rsense/fork">https://github.com/[my-github-username]/rsense/fork</a> )</li>
<li>Create your feature branch (<code>git checkout -b my-new-feature</code>)</li>
<li>Commit your changes (<code>git commit -am 'Add some feature'</code>)</li>
<li>Push to the branch (<code>git push origin my-new-feature</code>)</li>
<li>Create a new Pull Request</li>
</ol>
<h2 id="license">License</h2>
<p>RSense is distributed under the term of
<a href="http://gplv3.fsf.org/">GPLv3+</a>.</p>
<h2 id="credits">Credits</h2>
<p>Rsense was originally designed and implemented by <a href="https://github.com/m2ym/">Matsuyama Tomohiro(@m2ym)</a>, and his hard work is still at the core of rsense today. All of the algorithms for type-detection were implemented by him, with inspiration from multiple places. You can read about his original version at <a href="http://cx4a.org/software/rsense/">Rsense: A Ruby Development tools for Emacs, Vim and Others</a></p>
<p>In 2013, a major undertaking by @edubkendo to bring it current and improve its usefullness to rubyists was sponsored by the @jruby organization as a Google Summer of Code project.</p>
<p>Special thanks belongs to <a href="https://github.com/enebo">Tom Enebo (@enebo)</a> who provided excellent mentorship, code, architectural suggestions and more throughout the course of the update.</p>
<h2 id="community">Community</h2>
<p><a href="https://gitter.im/rsense/rsense"><img src="https://badges.gitter.im/rsense/rsense.png" alt="Gitter chat"></a></p>
<p><a href="https://waffle.io/rsense/rsense"><img src="https://badge.waffle.io/rsense/rsense.png?label=ready&title=Ready" alt="Stories in Ready"></a></p>
<p><a href="https://github.com/rsense/rsense">Github</a></p>