ruby-lsp-slim 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rubocop.yml +34 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +21 -0
- data/README.md +67 -0
- data/Rakefile +15 -0
- data/examples/slim_app/Gemfile +7 -0
- data/examples/slim_app/app/helpers/application_helper.rb +26 -0
- data/examples/slim_app/app/models/user.rb +28 -0
- data/examples/slim_app/app/views/home/index.slim +22 -0
- data/examples/slim_app/app/views/home/test.erb +3 -0
- data/examples/slim_app/app/views/layouts/application.slim +17 -0
- data/examples/slim_app/app/views/users/index.slim +24 -0
- data/examples/slim_app/app/views/users/show.slim +32 -0
- data/lib/ruby_lsp/ruby_lsp_slim/addon.rb +134 -0
- data/lib/ruby_lsp/ruby_lsp_slim/slim_document.rb +34 -0
- data/lib/ruby_lsp/ruby_lsp_slim/slim_scanner.rb +385 -0
- data/lib/ruby_lsp/ruby_lsp_slim/version.rb +5 -0
- data/lib/ruby_lsp_slim.rb +3 -0
- data/ruby-lsp-slim.gemspec +31 -0
- data/vscode/.vscodeignore +4 -0
- data/vscode/README.md +39 -0
- data/vscode/language-configuration.json +28 -0
- data/vscode/package-lock.json +625 -0
- data/vscode/package.json +47 -0
- data/vscode/src/extension.ts +90 -0
- data/vscode/tsconfig.json +15 -0
- metadata +110 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as vscode from "vscode";
|
|
2
|
+
import {
|
|
3
|
+
LanguageClient,
|
|
4
|
+
LanguageClientOptions,
|
|
5
|
+
ServerOptions,
|
|
6
|
+
} from "vscode-languageclient/node";
|
|
7
|
+
|
|
8
|
+
let client: LanguageClient | undefined;
|
|
9
|
+
|
|
10
|
+
export async function activate(context: vscode.ExtensionContext) {
|
|
11
|
+
const workspaceFolder = vscode.workspace.workspaceFolders?.[0];
|
|
12
|
+
if (!workspaceFolder) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const outputChannel = vscode.window.createOutputChannel("Ruby LSP Slim", {
|
|
17
|
+
log: true,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
outputChannel.info("Starting Ruby LSP Slim...");
|
|
21
|
+
|
|
22
|
+
// Let ruby-lsp handle its own bundling (SetupBundler) by NOT using
|
|
23
|
+
// `bundle exec`. This ensures it uses .ruby-lsp/Gemfile which includes
|
|
24
|
+
// all addon gems.
|
|
25
|
+
const env = { ...process.env };
|
|
26
|
+
delete env.BUNDLE_GEMFILE;
|
|
27
|
+
|
|
28
|
+
const serverOptions: ServerOptions = {
|
|
29
|
+
command: "ruby-lsp",
|
|
30
|
+
args: [],
|
|
31
|
+
options: {
|
|
32
|
+
cwd: workspaceFolder.uri.fsPath,
|
|
33
|
+
env: env,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const clientOptions: LanguageClientOptions = {
|
|
38
|
+
documentSelector: [
|
|
39
|
+
{ language: "slim", scheme: "file" },
|
|
40
|
+
{ language: "slim", scheme: "untitled" },
|
|
41
|
+
],
|
|
42
|
+
workspaceFolder: workspaceFolder,
|
|
43
|
+
outputChannel: outputChannel,
|
|
44
|
+
connectionOptions: {
|
|
45
|
+
maxRestartCount: 5,
|
|
46
|
+
},
|
|
47
|
+
initializationOptions: {
|
|
48
|
+
enabledFeatures: {
|
|
49
|
+
hover: true,
|
|
50
|
+
definition: true,
|
|
51
|
+
completion: true,
|
|
52
|
+
documentSymbols: true,
|
|
53
|
+
semanticHighlighting: true,
|
|
54
|
+
diagnostics: true,
|
|
55
|
+
workspaceSymbol: true,
|
|
56
|
+
foldingRanges: true,
|
|
57
|
+
selectionRanges: true,
|
|
58
|
+
documentHighlights: true,
|
|
59
|
+
documentLink: true,
|
|
60
|
+
codeLens: false,
|
|
61
|
+
formatting: false,
|
|
62
|
+
codeActions: false,
|
|
63
|
+
inlayHint: false,
|
|
64
|
+
onTypeFormatting: false,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
client = new LanguageClient(
|
|
70
|
+
"rubyLspSlim",
|
|
71
|
+
"Ruby LSP Slim",
|
|
72
|
+
serverOptions,
|
|
73
|
+
clientOptions
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
await client.start();
|
|
78
|
+
outputChannel.info("Ruby LSP Slim started successfully");
|
|
79
|
+
} catch (error) {
|
|
80
|
+
outputChannel.error(`Failed to start Ruby LSP Slim: ${error}`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
context.subscriptions.push(client);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export async function deactivate() {
|
|
87
|
+
if (client) {
|
|
88
|
+
await client.stop();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"target": "ES2020",
|
|
5
|
+
"outDir": "out",
|
|
6
|
+
"rootDir": "src",
|
|
7
|
+
"lib": ["ES2020"],
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"],
|
|
14
|
+
"exclude": ["node_modules"]
|
|
15
|
+
}
|
metadata
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ruby-lsp-slim
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Andrea Fomera
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: ruby-lsp
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 0.26.0
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '1.0'
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
26
|
+
- - ">="
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: 0.26.0
|
|
29
|
+
- - "<"
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: '1.0'
|
|
32
|
+
- !ruby/object:Gem::Dependency
|
|
33
|
+
name: slim
|
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '4.0'
|
|
39
|
+
- - "<"
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '6.0'
|
|
42
|
+
type: :runtime
|
|
43
|
+
prerelease: false
|
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
45
|
+
requirements:
|
|
46
|
+
- - ">="
|
|
47
|
+
- !ruby/object:Gem::Version
|
|
48
|
+
version: '4.0'
|
|
49
|
+
- - "<"
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
version: '6.0'
|
|
52
|
+
description: A Ruby LSP addon that provides language server features for Slim template
|
|
53
|
+
files.
|
|
54
|
+
executables: []
|
|
55
|
+
extensions: []
|
|
56
|
+
extra_rdoc_files: []
|
|
57
|
+
files:
|
|
58
|
+
- ".rubocop.yml"
|
|
59
|
+
- CHANGELOG.md
|
|
60
|
+
- Gemfile
|
|
61
|
+
- LICENSE.txt
|
|
62
|
+
- README.md
|
|
63
|
+
- Rakefile
|
|
64
|
+
- examples/slim_app/Gemfile
|
|
65
|
+
- examples/slim_app/app/helpers/application_helper.rb
|
|
66
|
+
- examples/slim_app/app/models/user.rb
|
|
67
|
+
- examples/slim_app/app/views/home/index.slim
|
|
68
|
+
- examples/slim_app/app/views/home/test.erb
|
|
69
|
+
- examples/slim_app/app/views/layouts/application.slim
|
|
70
|
+
- examples/slim_app/app/views/users/index.slim
|
|
71
|
+
- examples/slim_app/app/views/users/show.slim
|
|
72
|
+
- lib/ruby_lsp/ruby_lsp_slim/addon.rb
|
|
73
|
+
- lib/ruby_lsp/ruby_lsp_slim/slim_document.rb
|
|
74
|
+
- lib/ruby_lsp/ruby_lsp_slim/slim_scanner.rb
|
|
75
|
+
- lib/ruby_lsp/ruby_lsp_slim/version.rb
|
|
76
|
+
- lib/ruby_lsp_slim.rb
|
|
77
|
+
- ruby-lsp-slim.gemspec
|
|
78
|
+
- vscode/.vscodeignore
|
|
79
|
+
- vscode/README.md
|
|
80
|
+
- vscode/language-configuration.json
|
|
81
|
+
- vscode/package-lock.json
|
|
82
|
+
- vscode/package.json
|
|
83
|
+
- vscode/src/extension.ts
|
|
84
|
+
- vscode/tsconfig.json
|
|
85
|
+
homepage: https://github.com/afomera/ruby-lsp-slim
|
|
86
|
+
licenses:
|
|
87
|
+
- MIT
|
|
88
|
+
metadata:
|
|
89
|
+
homepage_uri: https://github.com/afomera/ruby-lsp-slim
|
|
90
|
+
source_code_uri: https://github.com/afomera/ruby-lsp-slim
|
|
91
|
+
changelog_uri: https://github.com/afomera/ruby-lsp-slim/blob/main/CHANGELOG.md
|
|
92
|
+
rubygems_mfa_required: 'true'
|
|
93
|
+
rdoc_options: []
|
|
94
|
+
require_paths:
|
|
95
|
+
- lib
|
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
|
+
requirements:
|
|
98
|
+
- - ">="
|
|
99
|
+
- !ruby/object:Gem::Version
|
|
100
|
+
version: 3.0.0
|
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
|
+
requirements:
|
|
103
|
+
- - ">="
|
|
104
|
+
- !ruby/object:Gem::Version
|
|
105
|
+
version: '0'
|
|
106
|
+
requirements: []
|
|
107
|
+
rubygems_version: 3.6.9
|
|
108
|
+
specification_version: 4
|
|
109
|
+
summary: Ruby LSP addon for Slim templates
|
|
110
|
+
test_files: []
|