-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bf0beec
Showing
12 changed files
with
1,159 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 @@ | ||
lib |
This file contains 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,4 @@ | ||
src | ||
tsconfig.json | ||
tslint.json | ||
*.map |
This file contains 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,30 @@ | ||
# coc-solargraph | ||
|
||
Ruby language server extension using [solargraph](http://solargraph.org/) | ||
for [coc.nvim](https://github.com/neoclide/coc.nvim). | ||
|
||
## Install | ||
|
||
Install solargraph by: | ||
|
||
gem install solargraph | ||
|
||
In your vim/neovim, run command: | ||
|
||
:CocInstall coc-solargraph | ||
|
||
## Features | ||
|
||
Coc support all features of [solargraph](https://github.com/castwide/solargraph) | ||
|
||
## Configuration options | ||
|
||
* `solargraph.enable` set to `false` to disable wxml language server. | ||
* `solargraph.trace.server` trace LSP traffic in output channel. | ||
* `solargraph.execArgv` add `execArgv` to `child_process.spawn` | ||
|
||
Trigger completion in your `coc-settings.json` to get full list. | ||
|
||
## License | ||
|
||
MIT |
This file contains 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,181 @@ | ||
{ | ||
"name": "coc-solargraph", | ||
"version": "1.0.0", | ||
"description": "solargraph extension for coc", | ||
"main": "lib/index.js", | ||
"publisher": "chemzqm", | ||
"engines": { | ||
"coc": "^0.0.15" | ||
}, | ||
"scripts": { | ||
"clean": "rimraf lib", | ||
"build": "tsc -p tsconfig.json", | ||
"prepare": "yarn clean && yarn build" | ||
}, | ||
"contributes": { | ||
"configuration": { | ||
"type": "object", | ||
"title": "Solargraph", | ||
"properties": { | ||
"solargraph.enable": { | ||
"type": "boolean", | ||
"default": true | ||
}, | ||
"solargraph.filetypes": { | ||
"type": "array", | ||
"default": [ | ||
"ruby" | ||
] | ||
}, | ||
"solargraph.trace.server": { | ||
"type": "string", | ||
"default": "off", | ||
"enum": [ | ||
"off", | ||
"messages", | ||
"verbose" | ||
] | ||
}, | ||
"solargraph.commandPath": { | ||
"type": "string", | ||
"default": "solargraph", | ||
"description": "Path to the solargraph command. Set this to an absolute path to select from multiple installed Ruby versions." | ||
}, | ||
"solargraph.useBundler": { | ||
"type": "boolean", | ||
"description": "Use `bundle exec` to run solargraph. (If this is true, the solargraph.commandPath setting is ignored.)", | ||
"default": false | ||
}, | ||
"solargraph.bundlerPath": { | ||
"type": "string", | ||
"description": "Path to the bundle executable, defaults to 'bundle'", | ||
"default": "bundle" | ||
}, | ||
"solargraph.checkGemVersion": { | ||
"type": "boolean", | ||
"description": "Automatically check if a new version of the Solargraph gem is available.", | ||
"default": true, | ||
"enum": [ | ||
true, | ||
false | ||
] | ||
}, | ||
"solargraph.completion": { | ||
"type": [ | ||
"boolean" | ||
], | ||
"description": "Enable completion", | ||
"default": true, | ||
"enum": [ | ||
true, | ||
false | ||
] | ||
}, | ||
"solargraph.hover": { | ||
"type": [ | ||
"boolean" | ||
], | ||
"description": "Enable hover", | ||
"default": true, | ||
"enum": [ | ||
true, | ||
false | ||
] | ||
}, | ||
"solargraph.diagnostics": { | ||
"type": [ | ||
"boolean" | ||
], | ||
"description": "Enable diagnostics", | ||
"default": false, | ||
"enum": [ | ||
true, | ||
false | ||
] | ||
}, | ||
"solargraph.autoformat": { | ||
"type": [ | ||
"boolean" | ||
], | ||
"description": "Enable automatic formatting while typing (WARNING: experimental)", | ||
"default": false, | ||
"enum": [ | ||
true, | ||
false | ||
] | ||
}, | ||
"solargraph.formatting": { | ||
"type": [ | ||
"boolean" | ||
], | ||
"description": "Enable document formatting", | ||
"enum": [ | ||
true, | ||
false | ||
], | ||
"default": false | ||
}, | ||
"solargraph.symbols": { | ||
"type": [ | ||
"boolean" | ||
], | ||
"description": "Enable symbols", | ||
"enum": [ | ||
true, | ||
false | ||
], | ||
"default": true | ||
}, | ||
"solargraph.definitions": { | ||
"type": [ | ||
"boolean" | ||
], | ||
"description": "Enable definitions (go to, etc.)", | ||
"enum": [ | ||
true, | ||
false | ||
], | ||
"default": true | ||
}, | ||
"solargraph.rename": { | ||
"type": [ | ||
"boolean" | ||
], | ||
"description": "Enable symbol renaming", | ||
"enum": [ | ||
true, | ||
false | ||
], | ||
"default": true | ||
}, | ||
"solargraph.references": { | ||
"type": [ | ||
"boolean" | ||
], | ||
"description": "Enable finding references", | ||
"enum": [ | ||
true, | ||
false | ||
], | ||
"default": true | ||
} | ||
} | ||
} | ||
}, | ||
"author": "chemzqm@gmail.com", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@chemzqm/tsconfig": "^0.0.3", | ||
"@chemzqm/tslint-config": "^1.0.17", | ||
"@types/node": "^10.9.4", | ||
"coc.nvim": "^0.0.15", | ||
"rimraf": "^2.6.2", | ||
"tslint": "^5.11.0", | ||
"typescript": "^3.0.3" | ||
}, | ||
"dependencies": { | ||
"tslib": "^1.9.3", | ||
"vscode-languageserver-protocol": "^3.12.0", | ||
"which": "^1.3.1" | ||
} | ||
} |
This file contains 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,43 @@ | ||
import Uri from 'vscode-uri' | ||
import querystring from 'querystring' | ||
import { LanguageClient } from 'coc.nvim' | ||
|
||
export default class SolargraphDocumentProvider { | ||
private docs: { [uri: string]: string } | ||
|
||
constructor(private languageClient: LanguageClient) { | ||
this.docs = {} | ||
} | ||
|
||
public updateAll(): void { | ||
Object.keys(this.docs).forEach(uri => { | ||
this.update(uri) | ||
}) | ||
} | ||
|
||
public remove(uri: string): void { | ||
delete this.docs[uri] | ||
} | ||
|
||
public provideTextDocumentContent(uri: string): string { | ||
if (!this.docs[uri]) { | ||
this.update(uri) | ||
} | ||
return this.docs[uri.toString()] || 'Loading...' | ||
} | ||
|
||
private parseQuery(query: string): any { | ||
return querystring.parse(query.replace(/^\?/, '')) | ||
} | ||
|
||
public update(uri: string): void { | ||
let method = '$/solargraph' + Uri.parse(uri).path | ||
let query = this.parseQuery(Uri.parse(uri).query) | ||
this.languageClient | ||
.sendRequest(method, { query: query.query }) | ||
.then((result: any) => { | ||
this.docs[uri.toString()] = result.content | ||
}) | ||
} | ||
|
||
} |
This file contains 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,66 @@ | ||
|
||
export class Configuration { | ||
private _workspace: string | ||
private _useBundler: Boolean | ||
private _bundlerPath: string | ||
private _commandPath: string | ||
private _withSnippets: Boolean | ||
private _viewsPath: string | ||
|
||
public constructor(workspace: string = null, useBundler: Boolean = false, bundlerPath = "bundle", commandPath = 'solargraph', withSnippets: Boolean = false, viewsPath: string = null) { | ||
this._workspace = workspace | ||
this._useBundler = useBundler | ||
this._bundlerPath = bundlerPath | ||
this._commandPath = commandPath | ||
this._withSnippets = withSnippets | ||
this._viewsPath = viewsPath | ||
} | ||
|
||
public get workspace(): string { | ||
return this._workspace | ||
} | ||
|
||
public set workspace(path: string) { | ||
this._workspace = path | ||
} | ||
|
||
public get useBundler(): Boolean { | ||
return this._useBundler | ||
} | ||
|
||
public set useBundler(bool: Boolean) { | ||
this._useBundler = bool | ||
} | ||
|
||
public get bundlerPath(): string { | ||
return this._bundlerPath | ||
} | ||
|
||
public set bundlerPath(path: string) { | ||
this._bundlerPath = path | ||
} | ||
|
||
public get commandPath(): string { | ||
return this._commandPath | ||
} | ||
|
||
public set commandPath(path: string) { | ||
this._commandPath = path | ||
} | ||
|
||
public get withSnippets(): Boolean { | ||
return this._withSnippets | ||
} | ||
|
||
public set withSnippets(bool: Boolean) { | ||
this._withSnippets = bool | ||
} | ||
|
||
public get viewsPath(): string { | ||
return this._viewsPath | ||
} | ||
|
||
public set viewsPath(path: string) { | ||
this._viewsPath = path | ||
} | ||
} |
Oops, something went wrong.