Closed django-wong closed 5 years ago
+1 >_<
Try this
Alter file typescript/libs/view_helpers.py
to update function is_typescript
like this:
def is_typescript(view):
"""Test if the outer syntactic scope is 'source.ts' or 'source.tsx' """
filename = view.file_name()
blocklist = [".vue", ".html"]
name, extension = os.path.splitext(filename)
if not filename:
return False
if extension in blocklist:
return False
try:
location = view.sel()[0].begin()
except:
return False
return (view.match_selector(location, 'source.ts') or
view.match_selector(location, 'source.tsx'))
Do not forget import os
@django-wong Good job, It works fine, thank you.
Thanks @django-wong. This saved my bacon as well, I was on the verge of giving up and stop using Typescript for new Vue files from now on.
One tip: doing it this way will also remove the typescript syntax highlighting and lint-on-save from your vue files as well, since Microsoft's implementation is a monolith, all or nothing. You can't easily get back lint-on-save in vue files, but you can get back syntax highlighting by installing the Typescript Syntax
for Sublime text, which as far as I can see is just a copy of this plugin's syntax higlighting exported into its own extension.
@nehbit that's true, also use LSP + vue-language-server can bring the code intellisence back
Sorry for the delay, the fix is out at #705.
Thank you!
I can disable typescript plugin globally but I still want this plugin enabled for my other pure typescript project or file