Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix extension by upgrading vscode #27

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
MIT License

Copyright (c) 2023 Test Double, Inc.
Copyright (c) 2019 Will Ockelmann-Wagner

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# vscode-alternate-file
# vscode-alternate-alternate-file

[![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)
[![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)
[![David Dependency Status](https://img.shields.io/david/alternate-file/vscode-alternate-file.svg)](https://david-dm.org/alternate-file/vscode-alternate-file)
**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)**

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.

Expand Down Expand Up @@ -74,18 +72,18 @@ There aren't any shortcuts set up by default. If you'd like to add some shortcut
```json
{
"key": "ctrl+alt+a",
"command": "alternate.alternateFile",
"command": "alternateFile.alternateFile",
"when": "editorTextFocus"
}
```

The commands are:

```text
alternate.alternateFile
alternate.alternateFileInSplit
alternate.createAlternateFile
alternate.createAlternateFileInSplit
alternateFile.alternateFile
alternateFile.alternateFileInSplit
alternateFile.createAlternateFile
alternateFile.createAlternateFileInSplit
```

### VSCode-Vim support
Expand All @@ -97,11 +95,11 @@ If you use [vscode-vim](https://github.com/VSCodeVim/Vim), it might be easier to
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["<leader>", "p", "a"],
"commands": [{ "command": "alternate.alternateFile" }]
"commands": [{ "command": "alternateFile.alternateFile" }]
},
{
"before": ["<leader>", "p", "s"],
"commands": [{ "command": "alternate.alternateFileInSplit" }]
"commands": [{ "command": "alternateFile.alternateFileInSplit" }]
}
]
}
Expand Down
63 changes: 23 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,96 +1,79 @@
{
"name": "vscode-alternate-file",
"displayName": "Alternate File",
"name": "vscode-alternate-alternate-file",
"displayName": "Alternate Alternate File",
"description": "Switch to and create spec files for any framework",
"version": "0.3.1",
"publisher": "will-wow",
"author": "Will Ockelmann-Wagner",
"version": "0.3.2",
"publisher": "testdouble",
"author": "Justin Searls <searls@gmail.com>",
"repository": {
"type": "git",
"url": "https://github.com/alternate-file/vscode-alternate-file.git"
"url": "https://github.com/testdouble/vscode-alternate-alternate-file.git"
},
"license": "MIT",
"engines": {
"vscode": ">=1.23.0",
"node": ">=8.11.3"
"vscode": "^1.75.0"
},
"keywords": [
"vscode",
"alternate",
"spec",
"test",
"projectile",
"projections"
"projections",
"projectionist"
],
"categories": [
"Other"
],
"badges": [
{
"url": "https://img.shields.io/azure-devops/build/AlternateFile/17c9d9be-71eb-46c2-8af1-e017d13fb009/1/master.svg",
"href": "https://dev.azure.com/AlternateFile/VsCodeAlternateFile/_build/latest?definitionId=1&branchName=master",
"description": "Build Status"
},
{
"url": "https://img.shields.io/david/alternate-file/vscode-alternate-file.svg",
"href": "https://david-dm.org/alternate-file/vscode-alternate-file",
"description": "Dependencies"
}
],
"icon": "assets/icon.png",
"galleryBanner": {
"color": "#172F54",
"theme": "dark"
},
"activationEvents": [
"onCommand:alternate.initProjections",
"onCommand:alternate.alternateFile",
"onCommand:alternate.alternateFileInSplit",
"onCommand:alternate.createAlternateFile",
"onCommand:alternate.createAlternateFileInSplit"
],
"main": "./out/extension",
"contributes": {
"commands": [
{
"command": "alternate.initProjections",
"command": "alternateFile.initProjections",
"title": "Initialize Projections File"
},
{
"command": "alternate.alternateFile",
"command": "alternateFile.alternateFile",
"title": "Alternate File"
},
{
"command": "alternate.alternateFileInSplit",
"command": "alternateFile.alternateFileInSplit",
"title": "Alternate File in Split"
},
{
"command": "alternate.createAlternateFile",
"command": "alternateFile.createAlternateFile",
"title": "Create Alternate File"
},
{
"command": "alternate.createAlternateFileInSplit",
"command": "alternateFile.createAlternateFileInSplit",
"title": "Create Alternate File in Split"
}
]
},
"scripts": {
"vscode:prepublish": "npm run compile",
"vscode:prepublish": "yarn run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"postinstall": "vscode-install",
"preversion": "npm run lint",
"test": "npm run compile && CODE_TESTS_WORKSPACE=./test-project CODE_DISABLE_EXTENSIONS=true node ./node_modules/vscode/bin/test",
"lint": "npm run lint-tslint && npm run lint-prettier",
"preversion": "yarn run lint",
"test": "yarn run compile && CODE_TESTS_WORKSPACE=./test-project CODE_DISABLE_EXTENSIONS=true node ./node_modules/vscode/bin/test",
"lint": "yarn run lint-tslint && yarn run lint-prettier",
"lint-tslint": "tslint -p . --config tslint.json",
"lint-prettier": "prettier --list-different \"**/*.{ts,json,md,yml}\"",
"format": "npm run format-tslint && npm run format-prettier",
"format": "yarn run format-tslint && yarn run format-prettier",
"format-tslint": "tslint -p . --fix --config tslint.json",
"format-prettier": "prettier --write \"**/*.{ts,json,md,yml}\""
"format-prettier": "prettier --write \"**/*.{ts,json,md,yml}\"",
"vsce:package": "vsce package --no-yarn --githubBranch main",
"vsce:publish": "vsce publish --no-yarn --githubBranch main"
},
"devDependencies": {
"@types/mocha": "^5.2.6",
"@types/sinon": "^7.0.9",
"@vscode/vsce": "^2.18.0",
"chai": "^4.2.0",
"chai-spies": "^1.0.0",
"prettier": "^1.16.4",
Expand Down
10 changes: 5 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ export const activate = async (
): Promise<void> => {
commands = [
vscode.commands.registerCommand(
"alternate.initProjections",
"alternateFile.initProjections",
initializeProjectionsHere
),
vscode.commands.registerCommand(
"alternate.alternateFile",
"alternateFile.alternateFile",
FindAlternate.openFile({ split: false })
),
vscode.commands.registerCommand(
"alternate.alternateFileInSplit",
"alternateFile.alternateFileInSplit",
FindAlternate.openFile({ split: true })
),
vscode.commands.registerCommand(
"alternate.createAlternateFile",
"alternateFile.createAlternateFile",
FindAlternate.createFile({ split: false })
),
vscode.commands.registerCommand(
"alternate.createAlternateFileInSplit",
"alternateFile.createAlternateFileInSplit",
FindAlternate.createFile({ split: true })
)
];
Expand Down
18 changes: 9 additions & 9 deletions src/test/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ describe("Extension Tests", () => {
testCases.map(({ description, implementation, spec }) => {
describe(`given tests ${description}`, () => {
it("finds a test", () =>
openAndCheck("alternate.alternateFile", 1, implementation, spec));
openAndCheck("alternateFile.alternateFile", 1, implementation, spec));

it("finds an implementation", () =>
openAndCheck("alternate.alternateFile", 1, spec, implementation));
openAndCheck("alternateFile.alternateFile", 1, spec, implementation));
});
});
});
Expand All @@ -63,15 +63,15 @@ describe("Extension Tests", () => {
describe(`given tests ${description}`, () => {
it("finds a test", () =>
openAndCheck(
"alternate.alternateFileInSplit",
"alternateFile.alternateFileInSplit",
2,
implementation,
spec
));

it("finds an implementation", () =>
openAndCheck(
"alternate.alternateFileInSplit",
"alternateFile.alternateFileInSplit",
2,
spec,
implementation
Expand All @@ -83,15 +83,15 @@ describe("Extension Tests", () => {
describe("given an untested file", () => {
it("doesn't switch to alternate", () =>
openAndCheck(
"alternate.alternateFileInSplit",
"alternateFile.alternateFileInSplit",
1,
untestedFile,
untestedFile
));

it("doesn't switch to alternate or change panes", () =>
openAndCheck(
"alternate.alternateFileInSplit",
"alternateFile.alternateFileInSplit",
1,
untestedFile,
untestedFile
Expand All @@ -104,15 +104,15 @@ describe("Extension Tests", () => {
});
it("creates a new alternate file", () =>
openAndCheck(
"alternate.createAlternateFile",
"alternateFile.createAlternateFile",
1,
untestedFile,
untestedFileSpec
));

it("creates a new alternate file in a new split", () =>
openAndCheck(
"alternate.createAlternateFileInSplit",
"alternateFile.createAlternateFileInSplit",
2,
untestedFile,
untestedFileSpec
Expand Down Expand Up @@ -155,7 +155,7 @@ describe("Extension Tests", () => {

await FilePane.open(0, startingPath);

await vscode.commands.executeCommand("alternate.initProjections");
await vscode.commands.executeCommand("alternateFile.initProjections");
const editor = FilePane.getActiveEditor();

if (!editor) throw "no active editor";
Expand Down
Loading