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

Vue file. Intellisense shows outdated list of exported members #355

Closed
undefinederror opened this Issue Jul 26, 2017 · 32 comments

Comments

Projects
None yet
10 participants
@undefinederror

undefinederror commented Jul 26, 2017

Info

  • Platform: Win
  • Vetur version: 0.9.3
  • VSCode version: 1.14.2

Problem

Sorry if this was already brought up, but I can't seem to find this mentioned in other issues.

In a .vue file, VS Code intellisense fails to retrieve exported members that have been added after the language server has started. third doesn't show up in the list.

image

From a plain .js file intellisense shows all exported members

image

Other that obviously closing and reopening VS Code, I found that changing the lang attribute in the script tag does refresh the list of exported members, while closing and reopening the file has no effect.

This happens for both js/ts.

Happy to provide additional details if needed.

@HerringtonDarkholme

This comment has been minimized.

Member

HerringtonDarkholme commented Jul 27, 2017

Thanks for report. This is a known issue.

Vue language server, the underlying server that power vetur, implements file change depending solely on editors. We need to change file change via file watching.

@undefinederror

This comment has been minimized.

undefinederror commented Jul 27, 2017

Thank you for your reply. Yes I thought this must have indeed been a known issue.

Looking forward to the next versions of vetur (expecially TLint integration).I am very impressed by it. Absolutely great job!

@Frizi

This comment has been minimized.

Frizi commented Sep 8, 2017

This issue seems very irritating now. I have to restart the editor very frequently or do hacks like changing lang="ts" to lang="tsx" and back every time I edit any ts or d.ts file.

I could help implementing a fix, but I would need some general guidance how to do it and where could it fit. This especially includes the general setup of plugin development. Done it before for atom, but vscode seems very different in that aspect.

@octref

This comment has been minimized.

Member

octref commented Sep 8, 2017

Need to think about how to do this, since the suggested file watching approach can be expensive on large projects.

@Frizi

This comment has been minimized.

Frizi commented Sep 9, 2017

I tried to look around how is it currently tackled, just out of curiousity. Could you explain a bit how does the plugin manage to respond on *.vue file updates, or maybe how does the typescript language server manages to do the same with all ts/d.ts/js files?

@HerringtonDarkholme

This comment has been minimized.

Member

HerringtonDarkholme commented Sep 9, 2017

@Frizi https://github.com/vuejs/vetur/blob/master/server/src/modes/script/serviceHost.ts#L97-L120

And grepping updateCurrentTextDocument will tell you how vetur updates vue file script.

For tsserver, you can read the source code in TypeScript's repo.

Implementing file watching isn't that hard. But I don't have the confidence to spend that much man effort for it. Indeed, two full time TS core team members spend about several weeks to implement tsserver IIRC.

@vuejs vuejs deleted a comment from KokoDoko Nov 14, 2017

@vuejs vuejs deleted a comment from KokoDoko Nov 14, 2017

@kuechlerm kuechlerm referenced this issue Dec 29, 2017

Closed

vetur 1.0 #188

11 of 12 tasks complete
@HerringtonDarkholme

This comment has been minimized.

Member

HerringtonDarkholme commented Jan 21, 2018

Now watcher API is exposed in the venerable TS2.7

Microsoft/TypeScript#20234

Let's do it!

Sadly, the watcher API is only for code transpilation. No Language Service is supported 😢
We still need to implement our own watcher.

@HerringtonDarkholme HerringtonDarkholme referenced this issue Jan 26, 2018

Closed

vetur works slow via SAMBA #507

3 of 3 tasks complete
@MisterGoodcat

This comment has been minimized.

MisterGoodcat commented Feb 4, 2018

I don't want to sound ungrateful, because you clearly have done a tremendous job with this project - thank you for that.

However, this issue obviously is the most critical showstopper for anyone considering TypeScript for single-file components, and it's beyond me how this is unadressed for such a long time. Anything but the most trivial applications will run into this problem immediately, and the whole benefit of your great plugin is turned useless by that. I personally have given up SFC solely because of this issue. :(

Anyway, I just wanted to leave some feedback to maybe add some more importance to it; please don't take it as bashing, I still marvel at what you have achieved so far.

@HerringtonDarkholme

This comment has been minimized.

Member

HerringtonDarkholme commented Feb 4, 2018

@octref Can you give a look at this?

I'm really busy with my new day job. Working on weekend doesn't allow me to invest much time on OSS.

@octref octref self-assigned this Feb 5, 2018

HerringtonDarkholme added a commit that referenced this issue Feb 20, 2018

Merge pull request #702 from HerringtonDarkholme/watch
partially fix #355, a crude watcher
@HerringtonDarkholme

This comment has been minimized.

Member

HerringtonDarkholme commented Feb 20, 2018

I have pushed a crude watcher for this ticket.

I don't think is well refined. Let's reopen this issue.

@talkdirty

This comment has been minimized.

talkdirty commented Apr 6, 2018

@HerringtonDarkholme That watcher implementation looks like a fine solution to me for the time being; I've just tested it and it seems to work fine. What makes you think it is not well refined? I agree this is quite ugly, but as long as VS doesn't provide their own Watcher API, it seems to be the only solution. I would be in favor of releasing the Plugin with this fix, this issue has been open for way too long for being this critical.
Otherwise, if you could elaborate on what is missing from the fix, I'd be willing to put some time into it.

@tbsvttr

This comment has been minimized.

tbsvttr commented Apr 11, 2018

I am very very grateful for all your good work, but this needs to be fixed soon.

@ktsn ktsn referenced this issue Apr 12, 2018

Closed

I use typescript in sfc, but it prompt wrong #759

0 of 3 tasks complete
@HerringtonDarkholme

This comment has been minimized.

Member

HerringtonDarkholme commented Apr 12, 2018

You can download preview version here. https://github.com/vuejs/vetur/releases/tag/0.11.8

The preview has a watcher for script update outside of vue file.

@octref octref referenced this issue May 17, 2018

Closed

High CPU usage from Vetur extension #789

3 of 3 tasks complete
@biluochun

This comment has been minimized.

biluochun commented May 21, 2018

Vetur:0.11.8 Add a crude file watcher. Now Vetur will pick up text change in TS/JS. Note this feature is experimental. Partially fix
Vetur:0.12.3 The new version seems to remove this support

@Tenrys

This comment has been minimized.

Tenrys commented May 31, 2018

This is still an issue as of 0.12.3.

@s-KaiNet

This comment has been minimized.

s-KaiNet commented May 31, 2018

@Tenrys the change was reverted because of some CPU issues. Let's wait for #800 to be resolved, because it should resolve the current issue as well.

@Tenrys

This comment has been minimized.

Tenrys commented May 31, 2018

I just saw, is it something that is going to be fixed as soon as the new VSCode version comes out or will a fix have to be developed once it does?

@s-KaiNet

This comment has been minimized.

s-KaiNet commented May 31, 2018

I believe it doesn't have any dependencies on vscode, FileEvents are available today. From my POV that's some ongoing work to centralize and unify some internal things in vetur, which also resolves the current issue. @octref please correct me if I'm wrong :)

@Tenrys

This comment has been minimized.

Tenrys commented May 31, 2018

I was wondering because of Microsoft/vscode#49327, the "Extension Contributions" part. However I just setup Insiders and it doesn't seem to make a difference. I'm not sure if this means that some new APIs are going to come out that are going to help with this.

@octref octref closed this in 6ef2132 Jun 4, 2018

@octref

This comment has been minimized.

Member

octref commented Jun 4, 2018

outdated

@Tenrys

This comment has been minimized.

Tenrys commented Jun 4, 2018

I just tried the latest revision out with the latest version of Insiders, and there seems to be an improvement!

However I'm noticing that the linter will only update/refresh if you type in the .vue file, if you do something like make a breaking change in another .js / .ts file which would render the .vue file's <script> area invalid.

Is this intended? Other linters update as soon as any referenced file is invalidated.

@s-KaiNet

This comment has been minimized.

s-KaiNet commented Jun 4, 2018

@Tenrys do you use TSLint Vue plugin? I believe it should catch all cases.

@Tenrys

This comment has been minimized.

Tenrys commented Jun 4, 2018

Well, I didn't know about that plugin and installed it, thanks. But that doesn't solve the issue, this is what I mean:

That warning will go away only once I type in my .vue file. It feels it should go away as I make changes. Or is it a setting I'm not aware about?

@s-KaiNet

This comment has been minimized.

s-KaiNet commented Jun 4, 2018

Probably @octref better knows the answer. For me it feels like an issue.

@octref

This comment has been minimized.

Member

octref commented Jun 4, 2018

@Tenrys Did you build from source and is running it? I haven't published the change yet.

@Tenrys

This comment has been minimized.

Tenrys commented Jun 4, 2018

Yeah I did, I cloned last revision then followed the instructions from CONTRIBUTING.md, though I also had to run yarn compile in the root folder to make IntelliSense work.
There is a difference from version 0.12.3 when it just wouldn't update unless I updated the lang attribute of the <script> area.

@octref

This comment has been minimized.

Member

octref commented Jun 4, 2018

@Tenrys Can you try to create a minimal example out of https://github.com/octref/veturpack?

Also you need to show how your Vue file looks like. I can't guess all the problems. I need repro cases to debug.

@Tenrys

This comment has been minimized.

Tenrys commented Jun 4, 2018

I'm not sure what I can showcase better using that repository, so here's a visual example of my issue, with the file structure and the code being displayed.

I am using the latest Insiders build and the latest revision from this repository, built using the instructions from CONTRIBUTING.md and running yarn compile in the extension's root directory. I've tried having all extensions disabled, except for Vetur, as well as debugging the extension, the result was the same.

https://tenrys.pw/ShareX/2018/Jun/fteE.mp4

Hopefully this helps you a bit more than what I sent earlier.

@octref

This comment has been minimized.

Member

octref commented Jun 5, 2018

@Tenrys Thanks for the report. The issue is I'm not retriggering error-checking on Vue files for each update/file change in TS.

@octref octref reopened this Jun 5, 2018

@octref octref closed this in 42abe14 Jun 5, 2018

@octref

This comment has been minimized.

Member

octref commented Jun 5, 2018

That's fixed too. I'm rerunning error-checking on all opened Vue files when you change JS/TS files. Let me know if this causes any performance problems.

@Tenrys

This comment has been minimized.

Tenrys commented Jun 5, 2018

Great work! Now it does the error checking as soon as I save or change a file. I'll make sure to notify you here if there is any performance issue with this change.

@octref

This comment has been minimized.

Member

octref commented Jun 6, 2018

This change is published to 0.12.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment