microsoft / TypeScript-Sublime-Plugin

IO wrapper around TypeScript language services, allowing for easy consumption by editor plugins
Apache License 2.0
1.72k stars 235 forks source link

Plugin suddenly cannot build typescript files or find names unless Sublime 3 is restarted #585

Open deanproxy opened 7 years ago

deanproxy commented 7 years ago

Plugin works fine for a period of time, but after working for a while and changing/saving files, I notice all of the sudden some of my class names and other namespaces cannot be found. I can't navigate to them with F12 (GoTo) and when I try to build a file, the compiler comes back with errors saying "Cannot find name InsertSomeNameHere"

There appears to be no errors in the console once this happens. The only way to fix the issues is to shut down SublimeText and reopen it. After reopening Sublime, everything works as expecting and I can build all files that were open and also GoTo any name as normal. Some random time later, this happens again and I have to shutdown and restart the editor again.

zhengbli commented 7 years ago

@gilbert this looks like the plugin is conflicting with the "TrailingSpace" plugin that you installed though

gilbert commented 7 years ago

Oh no, sorry about that. TypeScript plugin stopped working again, so I copied the first error I found. I will read before copy/pasting next time 😅

jmolero commented 7 years ago

I could get some logs for this issue while using local4.zip fix.

log19086.txt tsconfig.json.txt

kylebebak commented 5 years ago

There are many things that cause tsserver to fail (adding a module, changing the component in a module from a class component to a function component, etc).

Fortunately, this cool plugin, https://github.com/randy3k/AutomaticPackageReloader, has a command for reloading any Sublime Text plugin.

Install AutomaticPackageReloader and add something like the following to User/Default.sublime-commands:

{ "caption": "Reload TypeScript Package", "command": "package_reloader_reload", "args": {"pkg_name": "TypeScript"} },

Or, to your sublime-keymap file:

{ "keys": ["super+ctrl+alt+t"], "command": "package_reloader_reload", "args": {"pkg_name": "TypeScript"} },

This reloads the TypeScript package, and in most every case I've seen makes it actually start working again in a second or two. This is a lot easier and faster than restarting Sublime Text.

@DanielRosenwasser @zhengbli It might be good to add this solution to the documentation. If this issue is any indication the plugin crashes frequently (it certainly does in my experience) and it seems like there's no one able to fix the crash issues.

I'd be glad to add this to the docs and submit a PR if people think it's worth it.

tobek commented 5 years ago

@kylebebak your suggestion is a godsend. The number of times I've had to restart Sublime Text until now... This plugin works perfectly for me.

kylebebak commented 5 years ago

Glad it helped! And thanks @randy3k =)

raejin commented 4 years ago

@kylebebak Thank you so much for this workaround, I can now finally stop restarting sublime.