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

Folding provider crashes with "tokens.filter is not a function" #154

Closed
Gama11 opened this issue Dec 30, 2018 · 6 comments
Closed

Folding provider crashes with "tokens.filter is not a function" #154

Gama11 opened this issue Dec 30, 2018 · 6 comments
Labels

Comments

@Gama11
Copy link

Gama11 commented Dec 30, 2018

Whenever an AsciiDoc file is opened or modified, the following exception is logged to the dev console (even for empty files):

  ERR tokens.filter is not a function: TypeError: tokens.filter is not a function
	at MarkdownFoldingProvider.<anonymous> (C:\Users\<User>\.vscode\extensions\joaompinto.asciidoctor-vscode-2.3.0\out\src\features\foldingProvider.js:29:42)
	at Generator.next (<anonymous>)
	at fulfilled (C:\Users\<User>\.vscode\extensions\joaompinto.asciidoctor-vscode-2.3.0\out\src\features\foldingProvider.js:8:58)
	at <anonymous>

VSCode 1.30.1 and AsciiDoc 2.3.0.

@MatteoCampinoti94
Copy link
Member

Yes we are aware of the issue. It will be fixed once we update the extension to support outline tokens once again (atm the moment outline does not work with VSCode ^1.29).

@robertsweetman
Copy link

robertsweetman commented May 1, 2019

Seem to have run into this although we've been using VSCode ^ 1.29 successfully

Now, unfortunately, the 'Preview' functionality doesn't work anymore 👎

c:\Users\<USER>\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\extension
[2019-05-01 14:24:42.506] [exthost] [error] [joaompinto.asciidoctor-vscode] provider FAILED
[2019-05-01 14:24:42.506] [exthost] [error] TypeError: tokens.filter is not a function
	at AsciidocFoldingProvider.<anonymous> (c:\Users\rsweetman\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\features\foldingProvider.js:29:42)
	at Generator.next (<anonymous>)
	at fulfilled (c:\Users\rsweetman\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\features\foldingProvider.js:8:58)

What are 'outline tokens' in this context? Are they something we can do without in the asciidoc to avoid running into this? Thanks

@MatteoCampinoti94
Copy link
Member

MatteoCampinoti94 commented May 1, 2019

@robertiansweetman outline tokens are used to quickly navigate through your source. In markup languages they are usually the headers. You can see them if you open a Markdown file and open the tokens selector (CTRL+SHIFT+O).

Thankfully that error does not cause any problem with the rest of the extension, it is limited to the editor and the only victims are the tokens. We are still investigating what is the cause of it, because the error does not pop up with the linter or during packaging, it only appears in the log.

@robertsweetman
Copy link

@MatteoCampinoti94 looks like whatever you did with fixing Bug #191 has resolved the issue at least as long as I open VSCode and then the Asciidoc extension, so this isn't an issue for me now :)

If I have a preview window open, stop VSCode then open VSCode again it tries to load the preview window on startup but the preview doesn't render. Sadly I can't seem to capture the error for that!

In that case if you close the preview window and open it again it works fine. I'm on VSCode 1.33.1

@MatteoCampinoti94
Copy link
Member

MatteoCampinoti94 commented May 2, 2019

The preview not loading was caused by an error in the way the extension accessed the workspace folder, I misread the API documentation. ^^

That's expected behavior actually: the preview window displays a temporary content, converted from asciidoc to html and then fed to the previewer. When you close VSCode that temporary variable is lost and needs to be reassigned.

In the future we will make it so the preview refreshes automatically at startup, but currently we are focusing on overhauling the whole extension code code so quality of life improvements beyond options are going to be postponed for a while.

@robertsweetman
Copy link

@MatteoCampinoti94 yep, your approach totally makes sense 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants