Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Release Pipeline #788

Merged
merged 2 commits into from
Sep 20, 2016
Merged
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
33 changes: 21 additions & 12 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The following is a set of guidelines for contributing to Vim for VSCode.
These are just guidelines, not rules, use your best judgment and feel free to propose changes to this document in a pull request.
If you need help with Vim for VSCode, come visit our [Slack](https://vscodevim-slackin.azurewebsites.net/) community.
If you need help with Vim for VSCode, come visit our [Slack](https://vscodevim-slackin.azurewebsites.net/) community.
Thanks for helping us make Vim for VSCode better!

## Submitting Issues
Expand All @@ -15,8 +15,8 @@ When creating a new bug report do:

## Submitting Pull Requests

Pull requests are *awesome*.
If you're looking to raise a PR for something which doesn't have an open issue, consider creating an issue first.
Pull requests are *awesome*.
If you're looking to raise a PR for something which doesn't have an open issue, consider creating an issue first.
When submitting a PR, ensure:

1. Run all the tests and ensure they pass.
Expand All @@ -42,8 +42,8 @@ When submitting a PR, ensure:
## Developing

1. Watch for changes and recompile Typescript files. Run this in the `Vim` directory: `gulp watch`
2. Open up Visual Studio code and add the `Vim` directory as a folder.
3. Click on the debugger. You now have two options - Launch Extension (to play around with the extension) and Launch Tests (to run the tests).
2. Open up Visual Studio code and add the `Vim` directory as a folder.
3. Click on the debugger. You now have two options - Launch Extension (to play around with the extension) and Launch Tests (to run the tests).

## Code Architecture

Expand All @@ -54,9 +54,9 @@ The code is split into two parts - ModeHandler (which is essentially the Vim sta
Actions are all currently stuffied into actions.ts (sorry!). There are:
* BaseAction - the base Action type that all Actions derive from.
* BaseMovement - A movement, like `w`, `h`, `{`, etc. ONLY updates the cursor position. At worst, might return an IMovement, which indicates a start and stop. This is used for movements like aw which may actually start before the cursor.
* BaseCommand - Anything which is not just a movement is a Command. That includes motions which also update the state of Vim in some way, like `*`.
* BaseCommand - Anything which is not just a movement is a Command. That includes motions which also update the state of Vim in some way, like `*`.

At one point, I wanted to have actions.ts be completely pure (no side effects whatsoever), so commands would just return objects indicating what side effects on the editor they would have. This explains the giant switch in handleCommand in ModeHandler. I now believe this to be a dumb idea and someone should get rid of it.
At one point, I wanted to have actions.ts be completely pure (no side effects whatsoever), so commands would just return objects indicating what side effects on the editor they would have. This explains the giant switch in handleCommand in ModeHandler. I now believe this to be a dumb idea and someone should get rid of it.

Probably me. :wink:

Expand All @@ -66,25 +66,34 @@ It's contained entirely within modeHandler.ts. It's actually pretty complicated,

It consists of two data structures:

* VimState - this is the state of Vim. It's what actions update.
* VimState - this is the state of Vim. It's what actions update.
* RecordedState - this is temporary state that will reset at the end of a change. (RecordedState is a poor name for this; I've been going back and forth on different names).

#### How it works

1. `handleKeyEventHelper` is called with the most recent keypress.
1. `handleKeyEventHelper` is called with the most recent keypress.
2. `Actions.getRelevantAction` determines if all the keys pressed so far uniquely specify any action in actions.ts. If not, we continue waiting for keypresses.
3. `runAction` runs the action that was matched. Movements, Commands and Operators all have separate functions that dictate how to run them - `executeMovement`, `handleCommand`, and `executeOperator` respectively.
3. `runAction` runs the action that was matched. Movements, Commands and Operators all have separate functions that dictate how to run them - `executeMovement`, `handleCommand`, and `executeOperator` respectively.
4. Now that we've updated VimState, we run `updateView` with the new VimState to "redraw" VSCode to the new state.

#### vscode.window.onDidChangeTextEditorSelection

This is my hack to simulate a click event based API in an IDE that doesn't have them (yet?). I check the selection that just came in to see if it's the same as what I thought I previously set the selection to the last time the state machine updated. If it's not, the user *probably* clicked. (But she also could have tab completed!)

## Troubleshooting
## Release

To push a release:

1. Bump the version number and create a git tag: `gulp patch|minor|major`
2. Push the changes: `git push origin --tags`

In addition to building and testing the extension, when a tag is applied to the commit, the CI server will also create a GitHub release and publish the new version to the Visual Studio marketplace.

## Troubleshooting

### Visual Studio Code Slowdown

If your autocomplete, your fuzzy file search, or your _everything_ is suddenly running slower, try to recall if you ever ran `npm test` instead of just running tests through Visual Studio Code. This will add a massive folder called `.vscode-test/` to your project, which Visual Studio Code will happily consume all of your CPU cycles indexing.
If your autocomplete, your fuzzy file search, or your _everything_ is suddenly running slower, try to recall if you ever ran `npm test` instead of just running tests through Visual Studio Code. This will add a massive folder called `.vscode-test/` to your project, which Visual Studio Code will happily consume all of your CPU cycles indexing.

Long story short, you can speed up VSC by doing this:

Expand Down
96 changes: 59 additions & 37 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,59 @@
notifications:
email: false

sudo: false

os:
- osx
- linux

addons:
apt:
packages:
- xclip

language: node_js

node_js:
- "6.3.1"

env:
- GITHUB_TOKEN=1b17d62d38a4846efa7ea4de4b773b581787b0f1

before_install:
- if [ $TRAVIS_OS_NAME == "linux" ]; then
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start;
sleep 3;
fi

install:
- npm install
- npm run vscode:prepublish

script:
- npm install -g gulp
- gulp
- npm test --silent
notifications:
email: false

sudo: false

os:
- osx
- linux

addons:
apt:
packages:
- xclip

language: node_js

node_js:
- 6.3.1

env:
global:
secure: F3+6ObO8G2XDTXXSWizxdV4YzjWWwFKfISwYnKTwnAy4LXLPzcHnrh31rFmKeXSddZmWiVMhy++a4Y9IOTi0DrSnUYaaIP35zMIvMYIqdSa6v3b93Z0fwZmniXe0e4EBIhcdnMOz1fdxGhd0oWP/YyywOm32TjymhqbApT9AzqUodpGqRmA30B1tOFr09K+A2EiIr+4QGsB/a3VUv24zWWUHtkXaJ6tQ7rqt6944tGK4RtjAIzXLoePjJ+kmTqY6fMk/sPmYxHXnzjaEsIFBd5dYDCFtjR0oqjdq2OXc+bwIjl4t3Wh4RwE8bUEcUSnkPRqlJH5Hni5vfPRirb4qH4uoFmLNa8Pg2dPI44cYBvWVGSJ5GqXD5jV64waR3CM3VC2Ll76KWdlqdUo0cNIV75ul+UdieuNghTnw3OTYIWyhvrLqfnabOG81z09brNapZuCPj3rZ+sjTWf7beRoH877UGH0C6jimxNk0syjGL0+pXH0UR0dI+7RWaNyPAMfvjz3m9UpDw3NtdDGNMT1D3VgZz+INwU6XMUSpg36S1BzMTfi6NJm+srA5BDHyC/MuYjO+l/1gaj0+dvkpMyyj9btotYFmfemEFlm2AHGMkITaucUrmCQKIM9ZL7l/fZfvPkUGbaaLH7EONL7KLLaj6pk2z7na91/3I1pWg4yJDPE=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite sure but is it possible to put the key in Travis env instead of here?

Copy link
Member Author

@jpoon jpoon Sep 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they would have the same effect. (https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings)

I would prefer putting it in this manner as then our configs are in one central location and not scattered about and my plaintext keys are not stored anywhere.


before_install:
- if [ $TRAVIS_OS_NAME == "linux" ]; then
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start; sleep 3;
fi

install:
- npm install;

script:
- npm install -g gulp;
- gulp;
- npm test --silent;

after_success:
- npm install -g vsce;
- vsce package;

deploy:
- provider: releases
api_key:
secure: UTXZhDpOsvVIrGZY0GCk2EtAPOOjWBXfrgrNsLVZLsN6R/jLlAIjjO652DLpMuGwSrxPP8NZUCwLaOPfPL+xjK52trHZaAFjOrD+myieTPeF2zIvb26OEdfzvXMmDEP8oGxrC7WNohN/dWpP4/P2kAQ/XQoWwa0EbxqB+hReM3mqHUfEHUwrHg7eJmcDHdUbeukDV6g1mm54cQtNmCSZRqd9iihO9N2lNaZrd+7u06dLeu2Jw1tz+kFTEB9y2FqIGOr/KZt2z+ZJXDW3O4a8IFgTF4njfyXh9RW3UpiTE1cSwbWkL9PLHpg6RDWnTj8Bmf3B3P3UKgGHWczHoxNNAAEYziur4aZU9Gk0Q34uhmB1hiKmMZkq2Wt0wwb512y+xEcZE2F48STiES/HRGvk8/k5xE4iBPwvl+w/MdpVGKccQB5hVejSOpJHauxO6Uqw0ThEqR7QtHG6bRiBD049KmEvbhEYVnIJx/8HvjKLHF0ZAVeP1ZPSYRdn9GOUF91wA="
file_glob: true
file: "*.vsix"
skip_cleanup: true
on:
repo: vscodevim/vim
tags: true
condition: "$TRAVIS_OS_NAME = linux"
- provider: script
script: vsce publish -p $VS_TOKEN
skip_cleanup: true
on:
repo: vscodevim/vim
tags: true
condition: "$TRAVIS_OS_NAME = linux"
12 changes: 6 additions & 6 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ function versionBump(semver) {
.pipe(tag_version());
}

gulp.task('patch', function() { return versionBump('patch'); })
gulp.task('minor', function() { return versionBump('minor'); })
gulp.task('major', function() { return versionBump('major'); })

gulp.task('typings', function () {
return gulp.src('./typings.json')
.pipe(typings());
Expand Down Expand Up @@ -69,8 +65,12 @@ gulp.task('tslint', ['fix-whitespace'], function() {
return merge(srcs, tests);
});

gulp.task('default', ['tslint', 'compile']);

gulp.task('compile', shell.task(['npm run vscode:prepublish']));
gulp.task('watch', shell.task(['npm run compile']));
gulp.task('init', ['typings']);
gulp.task('default', ['tslint', 'compile']);
gulp.task('release', ['default', 'patch']);

gulp.task('patch', ['default'], function() { return versionBump('patch'); })
gulp.task('minor', ['default'], function() { return versionBump('minor'); })
gulp.task('major', ['default'], function() { return versionBump('major'); })