Skip to content

Commit eb76725

Browse files
authored
Adjust monorepo configurations (#1414)
1 parent 5ca36e2 commit eb76725

35 files changed

+557
-529
lines changed

vscode/.devcontainer/devcontainer.json .devcontainer/devcontainer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
22
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
33
{
4-
"name": "Node.js & TypeScript",
4+
"name": "ruby-lsp",
55
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
66
"image": "mcr.microsoft.com/devcontainers/typescript-node:0-20",
77
"features": {

.github/ISSUE_TEMPLATE/bug_template.yml

+30-24
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,39 @@ body:
88
attributes:
99
value: >
1010
Thank you for filing a bug report! Please answer the following questions to help us understand the issue.
11-
- type: input
12-
attributes:
13-
label: Ruby version
14-
description: The Ruby version being used to run the LSP
15-
validations:
16-
required: true
17-
- type: textarea
18-
attributes:
19-
label: Code snippet
20-
description: A code snippet that reproduces the issue
21-
placeholder: >
22-
If applicable, please include the smallest code snippet that reproduces the issue.
2311
- type: textarea
2412
attributes:
2513
label: Description
26-
description: Reproduction steps and an explanation of the observed behavior
27-
placeholder: >
28-
Before submitting the issue report, please try updating the ruby-lsp gem first. If the bug is related to a
29-
feature that involves automatically changing code, such as refactors or formatting, please include an example of
30-
the resulting code. You may want to include a screenshot or GIF of the issue.
31-
validations:
32-
required: true
33-
- type: textarea
34-
attributes:
35-
label: Expected output
36-
description: A description of the expected behavior
14+
description: Reproduction steps
3715
placeholder: >
38-
Describe what you expected to happen.
16+
### Before submitting
17+
18+
Please follow the instructions on
19+
[troubleshooting](https://github.com/Shopify/ruby-lsp/blob/main/TROUBLESHOOTING.md) and make sure you
20+
are:
21+
1. On the latest version of the Ruby LSP VS Code extension
22+
2. On the latest version of the Ruby LSP server gem
23+
3. On the latest version of VS Code
24+
25+
If the issue persist, please deleted this section and submit the report.
26+
27+
### Reproduction steps
28+
29+
<!--
30+
**IMPORTANT NOTE**
31+
Please provide as much detail about your development setup as possible. Often issues with the Ruby LSP are
32+
specific to a combination of operating system, Ruby version, Ruby version manager, the editor being used and
33+
project setup. The easier it is to reproduce the problem, the quicker it will likely take to fix it.
34+
-->
35+
36+
<!-- Suggested structure -->
37+
1. Start the Ruby LSP using a certain editor
38+
2. Open a Ruby file
39+
3. Do something
40+
4. See unexpected behavior
41+
42+
**Code snippet or error message**
43+
```ruby
44+
```
3945
validations:
4046
required: true

.github/dependabot.yml

+13
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@ updates:
1616
- "patch"
1717
exclude-patterns:
1818
- "prism"
19+
- package-ecosystem: "npm"
20+
directory: "vscode/"
21+
schedule:
22+
interval: "weekly"
23+
reviewers:
24+
- "Shopify/ruby-dev-exp"
25+
ignore:
26+
- dependency-name: "@types/vscode"
27+
groups:
28+
minor-and-patch:
29+
update-types:
30+
- "minor"
31+
- "patch"
1932
- package-ecosystem: "gitsubmodule"
2033
directory: "/"
2134
schedule:

.github/pull_request_template.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
### Motivation
22

3+
<!-- Closes # -->
4+
35
<!-- Explain why you are making this change. Include links to issues or describe the problem being solved, not the solution. -->
46

57
### Implementation

.github/workflows/ci.yml

+50-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CI
33
on: [push, pull_request]
44

55
jobs:
6-
lint:
6+
lint_ruby:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v3
@@ -24,7 +24,7 @@ jobs:
2424

2525
- name: Lint Ruby files and RBI shims
2626
run: bundle exec rubocop
27-
build:
27+
build_ruby:
2828
strategy:
2929
fail-fast: false
3030
matrix:
@@ -49,3 +49,51 @@ jobs:
4949

5050
- name: Run index troubleshooting tool
5151
run: bundle exec ruby-lsp-doctor
52+
lint_node:
53+
runs-on: ubuntu-latest
54+
steps:
55+
- uses: actions/checkout@v3
56+
57+
- name: Set up Node
58+
uses: actions/setup-node@v3
59+
with:
60+
node-version: "18"
61+
cache: "yarn"
62+
cache-dependency-path: "vscode"
63+
64+
- name: Lint
65+
working-directory: ./vscode
66+
run: |
67+
yarn --frozen-lockfile
68+
yarn run lint
69+
build_node:
70+
strategy:
71+
fail-fast: false
72+
matrix:
73+
os: [ubuntu-latest, macos-latest, windows-latest]
74+
runs-on: ${{ matrix.os }}
75+
76+
steps:
77+
- uses: actions/checkout@v3
78+
79+
- name: Set up Node
80+
uses: actions/setup-node@v3
81+
with:
82+
node-version: "18"
83+
cache: "yarn"
84+
cache-dependency-path: "vscode"
85+
86+
# We need some Ruby installed for the environment activation tests
87+
- name: Set up Ruby
88+
uses: ruby/setup-ruby@v1
89+
with:
90+
ruby-version: "3.3"
91+
92+
- name: Run tests
93+
working-directory: ./vscode
94+
env:
95+
DISPLAY: ":99.0"
96+
run: |
97+
yarn --frozen-lockfile
98+
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
99+
yarn run test

vscode/.github/workflows/publish.yml .github/workflows/publish.yml

+17-5
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ jobs:
1717
with:
1818
node-version: "18"
1919
cache: "yarn"
20-
21-
- name: 📦 Install dependencies
22-
run: yarn --frozen-lockfile
20+
cache-dependency-path: "vscode"
2321

2422
- name: Create CHANGELOG.md
2523
uses: actions/github-script@v6
@@ -36,15 +34,27 @@ jobs:
3634
const includePrereleases = context.payload.release.prerelease;
3735
3836
const changelog = releases
39-
.filter((release) => includePrereleases || !release.prerelease)
37+
.filter((release) => release.tag_name.startsWith?("vscode-ruby-lsp") && (includePrereleases || !release.prerelease))
4038
.map((release) => `# ${release.tag_name}\n${release.body}\n`)
4139
.join("\n");
4240
43-
fs.writeFileSync("CHANGELOG.md", changelog);
41+
fs.writeFileSync("vscode/CHANGELOG.md", changelog);
42+
43+
- name: Copy files needed for release
44+
run: |
45+
cp LICENSE.txt vscode/LICENSE.txt
46+
cp README.md vscode/README.md
47+
cp CODE_OF_CONDUCT.md vscode/CODE_OF_CONDUCT.md
48+
cp TROUBLESHOOTING.md vscode/TROUBLESHOOTING.md
49+
50+
- name: 📦 Install dependencies
51+
working-directory: ./vscode
52+
run: yarn --frozen-lockfile
4453

4554
# Stable releases
4655
- name: Publish extension in the marketplace
4756
if: "!github.event.release.prerelease"
57+
working-directory: ./vscode
4858
run: |
4959
yarn run package
5060
node_modules/.bin/vsce publish --packagePath vscode-ruby-lsp.vsix
@@ -54,6 +64,7 @@ jobs:
5464
# Prereleases
5565
- name: Package and publish prerelease extension in the marketplace
5666
if: "github.event.release.prerelease"
67+
working-directory: ./vscode
5768
run: |
5869
yarn run package_prerelease
5970
node_modules/.bin/vsce publish --pre-release --packagePath vscode-ruby-lsp.vsix
@@ -63,6 +74,7 @@ jobs:
6374
# Stable releases for OpenVSX
6475
- name: Publish extension on OpenVSX
6576
if: "!github.event.release.prerelease"
77+
working-directory: ./vscode
6678
run: |
6779
yarn run package
6880
node_modules/.bin/ovsx publish vscode-ruby-lsp.vsix -p ${{ secrets.OPENVSX_TOKEN }} --yarn

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@
88
/**/tmp/
99
/**/.dev/
1010
/docs
11+
12+
vscode/out
13+
vscode/dist
14+
vscode/node_modules
15+
vscode/.vscode-test/
16+
vscode/*.vsix

.vscode/extensions.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"recommendations": [
33
"shopify.ruby-extensions-pack",
4+
"dbaeumer.vscode-eslint",
45
"streetsidesoftware.code-spell-checker"
56
]
67
}

.vscode/settings.json

+21-6
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,43 @@
55
"editor.defaultFormatter": "Shopify.ruby-lsp"
66
},
77
// So features like completion can still be displayed with Sorbet in the dependencies
8-
"rubyLsp.bypassTypechecker": true,
98
"search.exclude": {
10-
"**/test/fixtures/prism": true
9+
"**/test/fixtures/prism": true,
10+
},
11+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
12+
"[typescript]": {
13+
"editor.codeActionsOnSave": {
14+
"source.fixAll.eslint": "explicit"
15+
},
1116
},
1217
"cSpell.languageSettings": [
1318
{
1419
"languageId": "*",
1520
"locale": "en",
16-
"dictionaries": ["wordsEn"]
21+
"dictionaries": [
22+
"wordsEn"
23+
]
1724
},
1825
{
1926
"languageId": "*",
2027
"locale": "en-US",
21-
"dictionaries": ["wordsEn"]
28+
"dictionaries": [
29+
"wordsEn"
30+
]
2231
},
2332
{
2433
"languageId": "*",
25-
"dictionaries": ["companies", "softwareTerms", "misc"]
34+
"dictionaries": [
35+
"companies",
36+
"softwareTerms",
37+
"misc"
38+
]
2639
},
2740
{
2841
"languageId": "ruby",
29-
"dictionaries": ["ruby"]
42+
"dictionaries": [
43+
"ruby"
44+
]
3045
}
3146
]
3247
}

CONTRIBUTING.md

+23-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
# CONTRIBUTING
22

3-
## Manually testing a change
3+
## Testing changes
4+
5+
### Tracing LSP requests and responses
6+
7+
LSP server tracing (logging) can be controlled through the `ruby lsp.trace.server` config key in the
8+
`.vscode/settings.json` config file.
9+
10+
Possible values are:
11+
12+
- `off`: no tracing
13+
- `messages`: display requests and responses notifications
14+
- `verbose`: display each request and response as JSON
15+
16+
### Manually testing a change
417

518
There are a few options for manually testing changes to Ruby LSP:
619

@@ -14,9 +27,7 @@ gem "ruby-lsp", path: "../../Shopify/ruby-lsp"
1427

1528
With both approaches, there is a risk of 'breaking' your local development experience, so keep an eye on the Ruby LSP output panel for exceptions as your make changes.
1629

17-
You can also refer to the advice about [Debugging and Tracing](https://github.com/Shopify/vscode-ruby-lsp#debugging).
18-
19-
## Running the test suite
30+
### Running the test suite
2031

2132
The test suite can be executed by running
2233
```shell
@@ -30,7 +41,7 @@ VERBOSE=1 bin/test
3041
bin/test test/requests/diagnostics_expectations_test.rb test_diagnostics__def_bad_formatting
3142
```
3243

33-
## Expectation testing
44+
### Expectation testing
3445

3546
To simplify the way we run tests over different pieces of Ruby code, we use a custom expectations test framework against
3647
a set of Ruby fixtures.
@@ -99,14 +110,14 @@ end
99110
2. Set breakpoints in the code as desired
100111
3. Click the debug button on top of test examples
101112

102-
## Debugging Running Ruby LSP Process
113+
## Live debugging
103114

104-
1. Open [vscode-ruby-lsp](https://github.com/Shopify/vscode-ruby-lsp) in VS Code
105-
2. Under `Run and Debug`, select `Run extension` and click the start button (or press F5)
106-
3. The extension host window opened will be running a Ruby LSP process with the debugger attached. To start debugging
107-
the live process, go under `Run and Debug`, select `Attach to existing server` and click the start button (or
108-
press F5)
109-
4. Add breakpoints and perform the actions necessary for triggering the requests you wish to debug
115+
1. Under `Run and Debug`, select `Run extension` and click the start button (or press F5)
116+
2. The extension host window opened will be running the development version of the VS Code extension. Putting break
117+
points in the extension code will allow debugging
118+
3. If you wish to debug the server process, go under `Run and Debug` in the extension host window,
119+
select `Attach to existing server` and click the start button (or press F5)
120+
3. Add breakpoints and perform the actions necessary for triggering the requests you wish to debug
110121

111122
## Screen Captures
112123

EDITORS.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Editors
22

33
This file contains community driven instructions on how to set up the Ruby LSP in editors other than VS Code. For VS
4-
Code, use the official [Ruby LSP extension](https://github.com/Shopify/vscode-ruby-lsp).
4+
Code, use the official [Ruby LSP extension](https://marketplace.visualstudio.com/items?itemName=Shopify.ruby-lsp).
55

66
<!-- When adding a new editor to the list, either link directly to a website containing the instructions or link to a
77
new H2 header in this file containing the instructions. -->

LICENSE.txt

+20
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,23 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
2222

23+
================================================================================
24+
The following files and related configuration in vscode/package.json are based
25+
on a sequence of adaptions: vscode/grammars/ruby.cson.json,
26+
vscode/grammars/erb.cson.json, vscode/languages/erb.json.
27+
28+
Copyright (c) 2016 Peng Lv
29+
Copyright (c) 2017-2019 Stafford Brunk
30+
https://github.com/rubyide/vscode-ruby
31+
32+
Released under the MIT license
33+
https://github.com/rubyide/vscode-ruby/blob/main/LICENSE.txt
34+
35+
Copyright (c) 2014 GitHub Inc.
36+
https://github.com/atom/language-ruby
37+
38+
Released under the MIT license
39+
https://github.com/atom/language-ruby/blob/master/LICENSE.md
40+
41+
https://github.com/textmate/ruby.tmbundle
42+
https://github.com/textmate/ruby.tmbundle#license

0 commit comments

Comments
 (0)