Skip to content

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

Open
microsoft/TypeScript
#15080

Description

@deanproxy

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.

Activity

  1. changed the title [-]Plugin suddenly cannot compile or find names unless Sublime 3 is restarted[/-] [+]Plugin suddenly cannot build typescript files or find names unless Sublime 3 is restarted[/+] on Feb 9, 2017
  2. mxchange commented on Feb 10, 2017

    @mxchange

    I have had the same issue for the past 3 weeks as well, having to restart sublime 3 because the path resolving will not update, and keep displaying an import as not existing. Seemingly crashed, until restart.

    In some cases it even seems to stop working all together, showing no errors, when there are.

  3. alexcorvi commented on Feb 10, 2017

    @alexcorvi

    Same issue here. May I suggest a command to restart the compiler service so I don't have to close then open the sublime window (It has also been suggested in #584).

  4. deanproxy commented on Feb 13, 2017

    @deanproxy
    Author

    Martijn (@mxchange) Ali A. Saleem (@alexcorvi) Are either one of you using Vintageous? I'm curious if this plugin has anything to do with Typescript messing up... Seems like it wouldn't have any bearing on the situation, but I can't figure out what is happening.

  5. alexcorvi commented on Feb 13, 2017

    @alexcorvi

    I'm not using Vintageous.
    This issue occurs more frequently on large projects when I choose to show the errors list from the command platelet.

  6. deanproxy commented on Feb 13, 2017

    @deanproxy
    Author

    okay. that rules out that theory then...

    It happens to me and I'm not using the show the errors list option when it happens. It's usually after I save a file within my project.

  7. cjke commented on Feb 15, 2017

    @cjke

    This happens to me frequently as well. I'm temporarily using VSCode until its resolved (though I prefer Sublime).

    For maintainers, as mentioned in a few other issues on here, I too wasn't able to get logs to generate - but I can say that by monitoring ps aux | grep typescript that when things went south, there was at least 2+ tsservers running under sublime. Restarting sublime reduced that count back to exactly one.

    I'd settled for a quick tsserver restart from within sublime, but ideally fixed properly. Happy to debug, but need instructions on how to correctly activate the generation of the log files

  8. it6 commented on Feb 17, 2017

    @it6
    Contributor

    I experienced similar issues, but once I moved away from NVM and N and installed a single version of node this issue went away.

    Update 3/1/17
    It's actually node version 4 that fixed this issue. Not sure if NVM or N has any role to play.

  9. speedy250 commented on Apr 4, 2017

    @speedy250

    Can confirm this is still an issue. In the course of today I've had Sublime crash like 12 times. Any word on a fix Zhengbo Li (@zhengbli) ?
    Chris (@cjke) did you get any success in fixing this problem?
    In trying to fix this, I deleted the Sublime 3 folder from RoamingData (like creating a fresh install) and reinstalled all packages, but this did not fix so don't waste your time.
    Running on Windows 10, Sublime build 3126, Node 7.8.0 through NVM 1.1.3

  10. it6 commented on Apr 5, 2017

    @it6
    Contributor

    I still see this happening, also looks like there is no active development on this repo. I started writing more typescript and this is becoming a pain point. Thanks for the plugin and please fix this ASAP.

  11. speedy250 commented on Apr 5, 2017

    @speedy250

    1-9 Maybe there is a version of the plugin that works properly we can find?

    This has been such a great plugin up to now, and I don't want to switch to VSCode. It is now crashing at least 1-2 times per hour, sometimes more frequently.

    Is there anyone NOT experiencing? Hit me up! I want to compare settings to diagnose more.

  12. it6 commented on Apr 5, 2017

    @it6
    Contributor

    @shudson250 I agree this is really frustrating, I want to look into the plugin code see what could be causing this behavior. Which version of Node are you using? Do you use any version managers (nvm, n, etc..)? I notice this is happening when I open a second typescript file. I read some where it is creating a new typescript thread/instance not sure if this is the issue.

  13. zhengbli commented on Apr 5, 2017

    @zhengbli
    Contributor

    @shudson250 1-9 can you provide a minimal repro code sample where this issue happens?
    What TypeScript version / node version are you using?

  14. it6 commented on Apr 5, 2017

    @it6
    Contributor

    Zhengbo Li (@zhengbli), thanks for chiming in I am running NVM and on node v 7.8.0 (Mac OS 10.12 Seirra)

    Problem - randomly I see a squiggly lines under my imports and modules and sublime can't do jump to definition etc.. Its kind of like the plugin has lost context of some modules. This happens only on custom name spaced modules and the imports from the file with actual path work fine.

    I will add a screenshot once I have it

    I tried random things
    -- reinstalling the plugin
    -- move away from NVM and go to a single version of node

    The only way I was able to fix this is by restarting sublime.

    Appreciate your help in advance, thanks.

  15. zhengbli commented on Apr 5, 2017

    @zhengbli
    Contributor

    Thanks for the info. I assume you are using the TS version that came with the plugin? Can you share your tsconfig.json file? Previously I heard about a similar issue caused by the tsconfig.json including too many source files accidentally.

  16. 30 remaining items

  17. zhengbli commented on Apr 8, 2017

    @zhengbli
    Contributor

    Updated now, if anyone can try again

  18. it6 commented on Apr 8, 2017

    @it6
    Contributor

    Zhengbo Li (@zhengbli) - oooohhhhhh finally, I was able to fix it by editing tsserver.js in Sublime Text 3/Packages/TypeScript/tsserver

    remove/comment the line this.removeProject(project);, which is making the plugin crash

      if (projectsToRemove) {
                        for (var _b = 0, projectsToRemove_1 = projectsToRemove; _b < projectsToRemove_1.length; _b++) {
                            var project = projectsToRemove_1[_b];
                            // this.removeProject(project);
                        }
                    }
    

    Is there a way to set projectsToRemove to false so this.removeProject(project) will not be called.

  19. zhengbli commented on Apr 10, 2017

    @zhengbli
    Contributor

    That would be bad as your once-opened project would be hanging around forever. I tested on a mac, but still couldn't figure out where does the "unknown" command come from. And I think that is where the problem is.

  20. it6 commented on Apr 11, 2017

    @it6
    Contributor

    On close of Sublime will the typescript server stop? Then the project will be closed too I assume. But yes the project will be hanging until you close sublime.

    Once I close the last file in a project removeProject() is called but when I navigate to the existing project file from previously opened tab tsserver is not recreating the project

  21. gilbert commented on May 31, 2017

    @gilbert

    Zhengbo Li (@zhengbli) I installed the files in local4.zip and things seem to be working well so far.

  22. gilbert commented on Jun 5, 2017

    @gilbert

    Well, maybe not. Here's another crash report:

    Traceback (most recent call last):
      File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 389, in run_callback
        expr()
      File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 458, in <lambda>
        run_callback('on_pre_save', callback, lambda: callback.on_pre_save(v))
      File "trailing_spaces in /Users/tapwater/Library/Application Support/Sublime Text 3/Installed Packages/TrailingSpaces.sublime-package", line 424, in on_pre_save
      File "trailing_spaces in /Users/tapwater/Library/Application Support/Sublime Text 3/Installed Packages/TrailingSpaces.sublime-package", line 440, in freeze_last_version
      File "./python3.3/codecs.py", line 896, in open
    FileNotFoundError: [Errno 2] No such file or directory: '/Users/tapwater/p/app-app/client/public/style.css'
    
  23. zhengbli commented on Jun 5, 2017

    @zhengbli
    Contributor

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

  24. gilbert commented on Jun 5, 2017

    @gilbert

    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 😅

  25. jmolero commented on Aug 22, 2017

    @jmolero

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

    log19086.txt
    tsconfig.json.txt

  26. kylebebak commented on Apr 26, 2019

    @kylebebak
    Contributor

    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.

    Daniel Rosenwasser (@DanielRosenwasser) Zhengbo Li (@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.

  27. tobek commented on Jun 14, 2019

    @tobek

    Kyle Bebak (@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.

  28. kylebebak commented on Jun 14, 2019

    @kylebebak
    Contributor

    Glad it helped! And thanks Randy Lai (@randy3k) =)

  29. raejin commented on Oct 17, 2019

    @raejin

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions