Skip to content

Commit

Permalink
Merge pull request #29 from kortina/ak-cleanup-2
Browse files Browse the repository at this point in the history
Continue cleanup from 26
  • Loading branch information
kortina authored May 31, 2020
2 parents 7bae149 + b1024e8 commit 3d11507
Show file tree
Hide file tree
Showing 27 changed files with 9,187 additions and 1,705 deletions.
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12.16.3
52 changes: 35 additions & 17 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
{
"cSpell.words": [
"Backlinks",
"Devops",
"Suping",
"basenames",
"filepath",
"jumplist",
"notetaking",
"nvalt",
"prefill",
"unist",
"vpackage",
"vpublish",
"vsce",
"vsix"
]
}
"runInTerminal.commands": [
//////////////////////
// jest typescript
//////////////////////
// jest: test line
{
"cmd": "./jest-focused.sh ${relativeFile}:${line}",
"match": "\\.ts$",
"name": "l"
},
// jest: test suite
{
"cmd": "npx jest",
"match": "\\.ts$",
"name": "s"
}
],
"cSpell.words": [
"Backlink",
"Backlinks",
"Devops",
"Suping",
"basenames",
"filepath",
"jumplist",
"notetaking",
"nvalt",
"prefill",
"unist",
"vpackage",
"vpublish",
"vsce",
"vsix"
]
}
55 changes: 42 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# VS Code Markdown Notes

Use `[[wiki-links]]` and `#tags` for fast-navigation between notes kept in in a VS Code workspace. Quickly create new notes from a Title Case Note Name.
Use `[[wiki-links]]`, `backlinks`, and `#tags` for fast-navigation of markdown notes.

There are many great note-taking applications ([Notational Velocity](http://notational.net/), [nvalt](https://brettterpstra.com/projects/nvalt/), [Bear](https://bear.app/), [FSNotes](https://fsnot.es/)), but few of them offer the extensibility of VS Code and the ability to use Vim bindings for editing notes.
Automatically create notes from new inline `[[wiki-links]]`.

This extension provides a number of the best features invented by these other great apps.
Bring some of the awesome features from apps like [Notational Velocity](http://notational.net/), [nvalt](https://brettterpstra.com/projects/nvalt/), [Bear](https://bear.app/), [FSNotes](https://fsnot.es/), [Obsidian](https://obsidian.md/) to VS Code, where you also have (1) Vim key bindings and (2) excellent extensibility.

You can [install it from the VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=kortina.vscode-markdown-notes). See also my other customizations for note-taking in this blog post: [Suping Up VS Code as a Markdown Notebook](https://kortina.nyc/essays/suping-up-vs-code-as-a-markdown-notebook/).
[Install from the VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=kortina.vscode-markdown-notes). See more in the blog post: [Suping Up VS Code as a Markdown Notebook](https://kortina.nyc/essays/suping-up-vs-code-as-a-markdown-notebook/).

### `[[wiki-links]]`

Expand Down Expand Up @@ -35,6 +35,10 @@ You can bind this to a keyboard shortcut by adding to your `keybindings.json`:

### Screenshots

#### Create New Note On Missing Go To Definition

![create-note-on-missing-go-to-definition](demo/create-note-on-missing-go-to-definition.gif)

#### Intellisense Completion for Wiki Links, `uniqueFilenames`

![completion-unique-filenames](demo/completion-unique-filenames.gif)
Expand All @@ -43,6 +47,10 @@ You can bind this to a keyboard shortcut by adding to your `keybindings.json`:

![completion-relative-paths](demo/completion-relative-paths.gif)

### Backlinks Explorer Panel

![backlinks](demo/backlinks.gif)

#### Syntax Highlighting for Tags and Wiki Links

![syntax-highlighting](demo/syntax-highlighting.png)
Expand All @@ -51,14 +59,6 @@ You can bind this to a keyboard shortcut by adding to your `keybindings.json`:

![peek-and-go-to-definition](demo/peek-and-go-to-definition.gif)

#### Create New Note On Missing Go To Definition

![create-note-on-missing-go-to-definition](demo/create-note-on-missing-go-to-definition.gif)

#### New Note Command

![new-note-command](demo/new-note-command.gif)

#### Peek References to Wiki Links

![peek-references-wiki-link](demo/peek-references-wiki-link.png)
Expand All @@ -79,6 +79,10 @@ You can bind this to a keyboard shortcut by adding to your `keybindings.json`:

![tag-search](demo/tag-search.gif)

#### New Note Command

![new-note-command](demo/new-note-command.gif)

## dev

Run `npm install` first.
Expand Down Expand Up @@ -108,11 +112,36 @@ Run `npm install` first.
### TODO

- Provide better support for ignore patterns, eg, don't complete `file.md` if it is within `ignored_dir/`
- Should we support filename without extension, eg, assume `[[file]]` is a reference to `file.md`?
- Add option to complete files without extension, to `[[file]]` vs `file.md`
- Should we support links to headings? eg, `file.md#heading-text`?

### Development and Release

#### Test

For focused jest tests,

- install: https://marketplace.visualstudio.com/items?itemName=kortina.run-in-terminal
- and https://marketplace.visualstudio.com/items?itemName=vscodevim.vim

Run a focused test with `,rl` on a line in a test file, eg line 8, which will make a call to:

```sh
./jest-focused.sh ./src/test/jest/extension.test.ts:8
```

to run only the test at that line. NB, you will also need [these bindings](https://github.com/kortina/dotfiles/blob/e03cea00427ebd3f306ae6a113658934037f7262/vscode/settings.json#L170) for `,rl`

To run all tests,

```sh
npx jest
```

All tests are headless.

#### Release

To create a new release,

```sh
Expand Down
4 changes: 4 additions & 0 deletions __mocks__/vscode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// see: https://github.com/microsoft/vscode-test/issues/37
export const vscode = {
// mock the vscode API which you use in your project. Jest will tell you which keys are missing.
};
Binary file added demo/backlinks.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions jest-focused.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
# Usage:
# Run test at line 248 of extension.test.js:
# ./jest-run-focused-test.sh out/test/jest/extension.test.js:248
# Run all tests in extension.test.js:
# ./jest-run-focused-test.sh out/test/jest/extension.test.js
#
set -e
# location of script that will parse out the test function given a filepath and line
test_at_line_js="out/test-at-line.js"

# arg $1 is the test filename
# replace "/./"" with "/" (artifact of vscode-run-in-terminal starting relative path with a "./")
filename=`echo "$1" | sed 's/\.\/src/.\/out/'`
# replace 'ts' with 'js' in filename
filename=`echo "$filename" | sed 's/\.ts$/.js/'`
filename=`echo "$filename" | sed 's/\.ts:/.js:/'`
# strip the linenumber off the location
filename=`echo "$filename" | sed 's/:.*//'`

config_file="jest.config.js"

npm run compile

# if given file + line number, parse out the test name to run and pass in as a focused test run
if echo "$1" | grep -q ":[0-9]\+$" ; then
cmd="node $(pwd)/ $testloc"
bdd_description=$(node $(pwd)/$test_at_line_js $1)
bdd_size=${#bdd_description}
if [ $bdd_size -eq 0 ]; then
echo "Not in a describe block, nothing to run!"
exit 1
fi
else
echo "No line number, running entire file."
fi

echo ""
echo "$bdd_description"
echo ""
shift;

# Removed --max_old_space_size=4096
if [[ $* == *--debug* ]]
then
set -x
node --inspect --inspect-brk ./node_modules/.bin/jest --config "$config_file" --runInBand "$filename" -t "$bdd_description" "$@"
else
set -x
node ./node_modules/.bin/jest --config "$config_file" "$filename" -t "$bdd_description" "$@"
fi
6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
// roots: ['<rootDir>/out'],
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['<rootDir>/out/test/jest/**/*.test.js'], // for some reason I don't get, there are tests compile in out/test and out/src/test
};
Loading

0 comments on commit 3d11507

Please sign in to comment.