Skip to content

Commit 2ae8e39

Browse files
committed
Rename and reconfigure the extension
Also: * Change command name prefix so it won't conflict if both extensions are installed * Use yarn consistently instead of mix-and-matching npm + yarn
1 parent 8c04e4c commit 2ae8e39

File tree

6 files changed

+676
-74
lines changed

6 files changed

+676
-74
lines changed

LICENSE

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
MIT License
22

3+
Copyright (c) 2023 Test Double, Inc.
34
Copyright (c) 2019 Will Ockelmann-Wagner
45

56
Permission is hereby granted, free of charge, to any person obtaining a copy

README.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# vscode-alternate-file
1+
# vscode-alternate-alternate-file
22

3-
[![Visual Studio Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/will-wow.vscode-alternate-file.svg)](https://marketplace.visualstudio.com/items?itemName=will-wow.vscode-alternate-file)
4-
[![Build Status](https://img.shields.io/azure-devops/build/AlternateFile/17c9d9be-71eb-46c2-8af1-e017d13fb009/1/master.svg)](https://dev.azure.com/AlternateFile/VsCodeAlternateFile/_build/latest?definitionId=1&branchName=master)
5-
[![David Dependency Status](https://img.shields.io/david/alternate-file/vscode-alternate-file.svg)](https://david-dm.org/alternate-file/vscode-alternate-file)
3+
**This is a fork of the unmaintained [vscode-alternate-file](https://github.com/alternate-file/vscode-alternate-file) which stopped working when their [vscode dependency fell too far out of date](https://github.com/alternate-file/vscode-alternate-file/pull/27)**
64

75
In Vim, you can often go to the "alternate file" for the active buffer - usually the spec file for an implementation, or vice versa - by pressing `:A`. This extension adds that functionality to VS Code.
86

@@ -74,18 +72,18 @@ There aren't any shortcuts set up by default. If you'd like to add some shortcut
7472
```json
7573
{
7674
"key": "ctrl+alt+a",
77-
"command": "alternate.alternateFile",
75+
"command": "alternateFile.alternateFile",
7876
"when": "editorTextFocus"
7977
}
8078
```
8179

8280
The commands are:
8381

8482
```text
85-
alternate.alternateFile
86-
alternate.alternateFileInSplit
87-
alternate.createAlternateFile
88-
alternate.createAlternateFileInSplit
83+
alternateFile.alternateFile
84+
alternateFile.alternateFileInSplit
85+
alternateFile.createAlternateFile
86+
alternateFile.createAlternateFileInSplit
8987
```
9088

9189
### VSCode-Vim support
@@ -97,11 +95,11 @@ If you use [vscode-vim](https://github.com/VSCodeVim/Vim), it might be easier to
9795
"vim.normalModeKeyBindingsNonRecursive": [
9896
{
9997
"before": ["<leader>", "p", "a"],
100-
"commands": [{ "command": "alternate.alternateFile" }]
98+
"commands": [{ "command": "alternateFile.alternateFile" }]
10199
},
102100
{
103101
"before": ["<leader>", "p", "s"],
104-
"commands": [{ "command": "alternate.alternateFileInSplit" }]
102+
"commands": [{ "command": "alternateFile.alternateFileInSplit" }]
105103
}
106104
]
107105
}

package.json

+23-40
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,79 @@
11
{
2-
"name": "vscode-alternate-file",
3-
"displayName": "Alternate File",
2+
"name": "vscode-alternate-alternate-file",
3+
"displayName": "Alternate Alternate File",
44
"description": "Switch to and create spec files for any framework",
5-
"version": "0.3.1",
6-
"publisher": "will-wow",
7-
"author": "Will Ockelmann-Wagner",
5+
"version": "0.3.2",
6+
"publisher": "testdouble",
7+
"author": "Justin Searls <searls@gmail.com>",
88
"repository": {
99
"type": "git",
10-
"url": "https://github.com/alternate-file/vscode-alternate-file.git"
10+
"url": "https://github.com/testdouble/vscode-alternate-alternate-file.git"
1111
},
1212
"license": "MIT",
1313
"engines": {
14-
"vscode": ">=1.23.0",
15-
"node": ">=8.11.3"
14+
"vscode": "^1.75.0"
1615
},
1716
"keywords": [
1817
"vscode",
1918
"alternate",
2019
"spec",
2120
"test",
2221
"projectile",
23-
"projections"
22+
"projections",
23+
"projectionist"
2424
],
2525
"categories": [
2626
"Other"
2727
],
28-
"badges": [
29-
{
30-
"url": "https://img.shields.io/azure-devops/build/AlternateFile/17c9d9be-71eb-46c2-8af1-e017d13fb009/1/master.svg",
31-
"href": "https://dev.azure.com/AlternateFile/VsCodeAlternateFile/_build/latest?definitionId=1&branchName=master",
32-
"description": "Build Status"
33-
},
34-
{
35-
"url": "https://img.shields.io/david/alternate-file/vscode-alternate-file.svg",
36-
"href": "https://david-dm.org/alternate-file/vscode-alternate-file",
37-
"description": "Dependencies"
38-
}
39-
],
4028
"icon": "assets/icon.png",
4129
"galleryBanner": {
4230
"color": "#172F54",
4331
"theme": "dark"
4432
},
45-
"activationEvents": [
46-
"onCommand:alternate.initProjections",
47-
"onCommand:alternate.alternateFile",
48-
"onCommand:alternate.alternateFileInSplit",
49-
"onCommand:alternate.createAlternateFile",
50-
"onCommand:alternate.createAlternateFileInSplit"
51-
],
5233
"main": "./out/extension",
5334
"contributes": {
5435
"commands": [
5536
{
56-
"command": "alternate.initProjections",
37+
"command": "alternateFile.initProjections",
5738
"title": "Initialize Projections File"
5839
},
5940
{
60-
"command": "alternate.alternateFile",
41+
"command": "alternateFile.alternateFile",
6142
"title": "Alternate File"
6243
},
6344
{
64-
"command": "alternate.alternateFileInSplit",
45+
"command": "alternateFile.alternateFileInSplit",
6546
"title": "Alternate File in Split"
6647
},
6748
{
68-
"command": "alternate.createAlternateFile",
49+
"command": "alternateFile.createAlternateFile",
6950
"title": "Create Alternate File"
7051
},
7152
{
72-
"command": "alternate.createAlternateFileInSplit",
53+
"command": "alternateFile.createAlternateFileInSplit",
7354
"title": "Create Alternate File in Split"
7455
}
7556
]
7657
},
7758
"scripts": {
78-
"vscode:prepublish": "npm run compile",
59+
"vscode:prepublish": "yarn run compile",
7960
"compile": "tsc -p ./",
8061
"watch": "tsc -watch -p ./",
81-
"postinstall": "vscode-install",
82-
"preversion": "npm run lint",
83-
"test": "npm run compile && CODE_TESTS_WORKSPACE=./test-project CODE_DISABLE_EXTENSIONS=true node ./node_modules/vscode/bin/test",
84-
"lint": "npm run lint-tslint && npm run lint-prettier",
62+
"preversion": "yarn run lint",
63+
"test": "yarn run compile && CODE_TESTS_WORKSPACE=./test-project CODE_DISABLE_EXTENSIONS=true node ./node_modules/vscode/bin/test",
64+
"lint": "yarn run lint-tslint && yarn run lint-prettier",
8565
"lint-tslint": "tslint -p . --config tslint.json",
8666
"lint-prettier": "prettier --list-different \"**/*.{ts,json,md,yml}\"",
87-
"format": "npm run format-tslint && npm run format-prettier",
67+
"format": "yarn run format-tslint && yarn run format-prettier",
8868
"format-tslint": "tslint -p . --fix --config tslint.json",
89-
"format-prettier": "prettier --write \"**/*.{ts,json,md,yml}\""
69+
"format-prettier": "prettier --write \"**/*.{ts,json,md,yml}\"",
70+
"vsce:package": "vsce package --no-yarn --githubBranch main",
71+
"vsce:publish": "vsce publish --no-yarn --githubBranch main"
9072
},
9173
"devDependencies": {
9274
"@types/mocha": "^5.2.6",
9375
"@types/sinon": "^7.0.9",
76+
"@vscode/vsce": "^2.18.0",
9477
"chai": "^4.2.0",
9578
"chai-spies": "^1.0.0",
9679
"prettier": "^1.16.4",

src/extension.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ export const activate = async (
99
): Promise<void> => {
1010
commands = [
1111
vscode.commands.registerCommand(
12-
"alternate.initProjections",
12+
"alternateFile.initProjections",
1313
initializeProjectionsHere
1414
),
1515
vscode.commands.registerCommand(
16-
"alternate.alternateFile",
16+
"alternateFile.alternateFile",
1717
FindAlternate.openFile({ split: false })
1818
),
1919
vscode.commands.registerCommand(
20-
"alternate.alternateFileInSplit",
20+
"alternateFile.alternateFileInSplit",
2121
FindAlternate.openFile({ split: true })
2222
),
2323
vscode.commands.registerCommand(
24-
"alternate.createAlternateFile",
24+
"alternateFile.createAlternateFile",
2525
FindAlternate.createFile({ split: false })
2626
),
2727
vscode.commands.registerCommand(
28-
"alternate.createAlternateFileInSplit",
28+
"alternateFile.createAlternateFileInSplit",
2929
FindAlternate.createFile({ split: true })
3030
)
3131
];

src/test/extension.test.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ describe("Extension Tests", () => {
5050
testCases.map(({ description, implementation, spec }) => {
5151
describe(`given tests ${description}`, () => {
5252
it("finds a test", () =>
53-
openAndCheck("alternate.alternateFile", 1, implementation, spec));
53+
openAndCheck("alternateFile.alternateFile", 1, implementation, spec));
5454

5555
it("finds an implementation", () =>
56-
openAndCheck("alternate.alternateFile", 1, spec, implementation));
56+
openAndCheck("alternateFile.alternateFile", 1, spec, implementation));
5757
});
5858
});
5959
});
@@ -63,15 +63,15 @@ describe("Extension Tests", () => {
6363
describe(`given tests ${description}`, () => {
6464
it("finds a test", () =>
6565
openAndCheck(
66-
"alternate.alternateFileInSplit",
66+
"alternateFile.alternateFileInSplit",
6767
2,
6868
implementation,
6969
spec
7070
));
7171

7272
it("finds an implementation", () =>
7373
openAndCheck(
74-
"alternate.alternateFileInSplit",
74+
"alternateFile.alternateFileInSplit",
7575
2,
7676
spec,
7777
implementation
@@ -83,15 +83,15 @@ describe("Extension Tests", () => {
8383
describe("given an untested file", () => {
8484
it("doesn't switch to alternate", () =>
8585
openAndCheck(
86-
"alternate.alternateFileInSplit",
86+
"alternateFile.alternateFileInSplit",
8787
1,
8888
untestedFile,
8989
untestedFile
9090
));
9191

9292
it("doesn't switch to alternate or change panes", () =>
9393
openAndCheck(
94-
"alternate.alternateFileInSplit",
94+
"alternateFile.alternateFileInSplit",
9595
1,
9696
untestedFile,
9797
untestedFile
@@ -104,15 +104,15 @@ describe("Extension Tests", () => {
104104
});
105105
it("creates a new alternate file", () =>
106106
openAndCheck(
107-
"alternate.createAlternateFile",
107+
"alternateFile.createAlternateFile",
108108
1,
109109
untestedFile,
110110
untestedFileSpec
111111
));
112112

113113
it("creates a new alternate file in a new split", () =>
114114
openAndCheck(
115-
"alternate.createAlternateFileInSplit",
115+
"alternateFile.createAlternateFileInSplit",
116116
2,
117117
untestedFile,
118118
untestedFileSpec
@@ -155,7 +155,7 @@ describe("Extension Tests", () => {
155155

156156
await FilePane.open(0, startingPath);
157157

158-
await vscode.commands.executeCommand("alternate.initProjections");
158+
await vscode.commands.executeCommand("alternateFile.initProjections");
159159
const editor = FilePane.getActiveEditor();
160160

161161
if (!editor) throw "no active editor";

0 commit comments

Comments
 (0)