8000 Add support for AsciiDoc by slavos1 · Pull Request #43 · yzhang-gh/vscode-dic-completion · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add support for AsciiDoc #43

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

Open
< 8000 div class="flex-auto min-width-0 mb-2"> wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Dictionary Completion",
"description": "Word Completion",
"icon": "images/dictionary.png",
"version": "1.2.2",
"version": "1.2.3",
Copy link
Owner

Choose a reason for hiding this comment

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

We usually do not update the version number in a feature commit. Just leave it to me and I will publish a new version after this PR is merged in.

Copy link
Author

Choose a reason for hiding this comment

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

Fair enough, would leave it out, thanks.

"publisher": "yzhang",
"license": "MIT",
"engines": {
Expand All @@ -19,6 +19,7 @@
"activationEvents": [
"onLanguage:markdown",
"onLanguage:latex",
"onLanguage:asciidoc",
"onLanguage:html",
"onLanguage:javascript",
"onLanguage:typescript",
Expand Down
3 changes: 3 additions & 0 deletions src/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(
vscode.languages.registerCompletionItemProvider(getDocSelector('markdown'), new DictionaryCompletionItemProvider("markdown")),
vscode.languages.registerCompletionItemProvider(getDocSelector('latex'), new DictionaryCompletionItemProvider("latex")),
vscode.languages.registerCompletionItemProvider(getDocSelector('asciidoc'), new DictionaryCompletionItemProvider("asciidoc")),
vscode.languages.registerCompletionItemProvider(getDocSelector('html'), new DictionaryCompletionItemProvider("html")),
vscode.languages.registerCompletionItemProvider(getDocSelector('todo'), new DictionaryCompletionItemProvider("markdown"))
);
Expand Down Expand Up @@ -214,6 +215,8 @@ class DictionaryCompletionItemProvider implements vscode.CompletionItemProvider
}

switch (this.fileType) {
case "asciidoc":
return this.completeByFirstLetter(firstLetter, addSpace);
Copy link
Owner

Choose a reason for hiding this comment

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

Looks good. But I guess there are some cases where we do not want a completion (e.g. urls). You can use regex101 (select ECMAScript in the left panel) to help you write those rules.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, would need to test it more in that case.

case "markdown":
// [caption](don't complete here)
if (/\[[^\]]*\]\([^\)]*$/.test(textBefore)) {
Expand Down
0