-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dcef1fc
commit d7e9c76
Showing
8 changed files
with
783 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
**Added** | ||
|
||
- New parser function signatures | ||
- Sticky scroll by sections | ||
|
||
**Fixed** | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import * as assert from 'assert'; | ||
import {getPositionParams} from './util'; | ||
import {provideHover} from '../hover'; | ||
|
||
const wikitext = ` | ||
__NOTOC__ | ||
{{ #LEN: }} | ||
{{ PAGESIZE }} | ||
`; | ||
|
||
describe('hoverProvider', () => { | ||
it('behavior switch', async () => { | ||
assert.deepStrictEqual(await provideHover(getPositionParams(__filename, wikitext, 1, 0)), { | ||
contents: { | ||
kind: 'markdown', | ||
value: 'Hides the table of contents (TOC).', | ||
}, | ||
range: { | ||
start: {line: 1, character: 0}, | ||
end: {line: 1, character: 9}, | ||
}, | ||
}); | ||
}); | ||
it('parser function', async () => { | ||
assert.deepStrictEqual(await provideHover(getPositionParams(__filename, wikitext, 2, 7)), { | ||
contents: { | ||
kind: 'markdown', | ||
value: | ||
`- **{{ #LEN:** *string* **}}** | ||
The #len function returns the length of the given string.`, | ||
}, | ||
range: { | ||
start: {line: 2, character: 2}, | ||
end: {line: 2, character: 7}, | ||
}, | ||
}); | ||
}); | ||
it('variable', async () => { | ||
assert.deepStrictEqual(await provideHover(getPositionParams(__filename, wikitext, 3, 4)), { | ||
contents: { | ||
kind: 'markdown', | ||
value: | ||
`- **{{ PAGESIZE** **}}** | ||
- **{{ PAGESIZE:** *page name* **}}** | ||
- **{{ PAGESIZE:** *page name* **|** R **}}** | ||
**[Expensive]** Returns the byte size of the specified page.`, | ||
}, | ||
range: { | ||
start: {line: 3, character: 2}, | ||
end: {line: 3, character: 12}, | ||
}, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import * as assert from 'assert'; | ||
import {getParams} from './util'; | ||
import {provideLinks} from '../links'; | ||
import type {DocumentLink} from 'vscode-languageserver/node'; | ||
|
||
const wikitext = ` | ||
[[ : help : a ]] | ||
{{ b }} | ||
{{ #invoke: c | c }} | ||
RFC 1 | ||
PMID 1 | ||
ISBN 1-2-3-4-5-6-7-8-9-0 | ||
[//d d] | ||
News:e | ||
<templatestyles src = f /> | ||
<q cite = "HTTPS://G/G"> | ||
`, | ||
results: DocumentLink[] = [ | ||
{ | ||
range: { | ||
start: {line: 1, character: 2}, | ||
end: {line: 1, character: 14}, | ||
}, | ||
target: 'https://mediawiki.org/wiki/Help%3AA', | ||
}, | ||
{ | ||
range: { | ||
start: {line: 2, character: 2}, | ||
end: {line: 2, character: 5}, | ||
}, | ||
target: 'https://mediawiki.org/wiki/Template%3AB', | ||
}, | ||
{ | ||
range: { | ||
start: {line: 3, character: 11}, | ||
end: {line: 3, character: 14}, | ||
}, | ||
target: 'https://mediawiki.org/wiki/Module%3AC', | ||
}, | ||
{ | ||
range: { | ||
start: {line: 4, character: 0}, | ||
end: {line: 4, character: 5}, | ||
}, | ||
target: 'https://tools.ietf.org/html/rfc1', | ||
}, | ||
{ | ||
range: { | ||
start: {line: 5, character: 0}, | ||
end: {line: 5, character: 6}, | ||
}, | ||
target: 'https://pubmed.ncbi.nlm.nih.gov/1', | ||
}, | ||
{ | ||
range: { | ||
start: {line: 6, character: 0}, | ||
end: {line: 6, character: 24}, | ||
}, | ||
target: 'https://mediawiki.org/wiki/Special%3ABooksources%2F1234567890', | ||
}, | ||
{ | ||
range: { | ||
start: {line: 7, character: 1}, | ||
end: {line: 7, character: 4}, | ||
}, | ||
target: 'https://d/', | ||
}, | ||
{ | ||
range: { | ||
start: {line: 8, character: 0}, | ||
end: {line: 8, character: 6}, | ||
}, | ||
target: 'news:e', | ||
}, | ||
{ | ||
range: { | ||
start: {line: 9, character: 22}, | ||
end: {line: 9, character: 23}, | ||
}, | ||
target: 'https://mediawiki.org/wiki/Template%3AF', | ||
}, | ||
{ | ||
range: { | ||
start: {line: 10, character: 11}, | ||
end: {line: 10, character: 22}, | ||
}, | ||
target: 'https://g/G', | ||
}, | ||
]; | ||
|
||
describe('documentLinkProvider', () => { | ||
it('https://mediawiki.org/wiki/$1', async () => { | ||
assert.deepStrictEqual( | ||
await provideLinks(getParams(__filename, wikitext).textDocument, 'https://mediawiki.org/wiki/$1'), | ||
results, | ||
); | ||
}); | ||
it('https://mediawiki.org/wiki/', async () => { | ||
assert.deepStrictEqual( | ||
await provideLinks(getParams(__filename, wikitext).textDocument, 'https://mediawiki.org/wiki/'), | ||
results, | ||
); | ||
}); | ||
it('https://mediawiki.org/wiki', async () => { | ||
assert.deepStrictEqual( | ||
await provideLinks(getParams(__filename, wikitext).textDocument, 'https://mediawiki.org/wiki'), | ||
results, | ||
); | ||
}); | ||
}); |
Oops, something went wrong.