★ wanayoo — archive 1999 https://github.com/Microsoft/TypeScript-Sublime-Plugin/pull/570Nouvelle recherche | Portail wanayoo
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

Add language support for JavaScript #570

Closed
wants to merge 1 commit into from
Closed

Add language support for JavaScript #570

wants to merge 1 commit into from

Conversation

@zhengbli
Copy link
Contributor

zhengbli commented Dec 9, 2016

Until now this plugin only handles .ts files and .tsx files. This PR adds supports for .js files and .jsx files as well.

return (view.match_selector(location, 'source.ts') or
view.match_selector(location, 'source.tsx'))
is_ts_file = view.match_selector(location, 'source.ts') or view.match_selector(location, 'source.tsx')
is_js_file = view.match_selector(location, 'source.jsx') and cli.enable_language_service_for_js

This comment has been minimized.

Copy link
@DanielRosenwasser

DanielRosenwasser Jan 2, 2017

Member

Does Sublime consider the entire region of a .js file to be a source.jsx scope? Or is this from supplying our own tmLanguage? Can you add a comment explaining, since it's not obvious why you're not checking for scope.js.

This comment has been minimized.

Copy link
@hoest

hoest Jun 7, 2017

I think adding the selector for source.js beside source.jsx would be better. Like mentioned in my other comment.

This comment has been minimized.

Copy link
@idiotWu

idiotWu Sep 16, 2017

Contributor

I am using view.match_selector(location, 'source.ts, source.tsx, source.js, source.jsx') here and it works perfectly.

@@ -1,5 +1,5 @@
{
"auto_complete_triggers" : [ {"selector": "source.ts", "characters": "."} ],
"auto_complete_triggers" : [ {"selector": "source.ts", "characters": "."}, {"selector": "source.jsx", "characters": "."} ],

This comment has been minimized.

Copy link
@hoest

hoest Jun 7, 2017

Better change this to source.js and add this selector to the TypeScriptReact.sublime-settings file.

Copy link

hoest left a comment

I don't think JavaScript.tmLanguage is needed in this plugin.

@batusai513

This comment has been minimized.

Copy link

batusai513 commented Sep 13, 2017

Any updates on this one?

@idiotWu

This comment has been minimized.

Copy link
Contributor

idiotWu commented Sep 16, 2017

I think some key trigger bindings should also be adjusted for JavaScript files, eg:

{
  "keys": ["("],
  "command": "typescript_signature_popup",
  "context": [
-      { "key": "selector", "operator": "equal", "operand": "source.ts, source.tsx" },
+      { "key": "selector", "operator": "equal", "operand": "source.ts, source.tsx, source.js, source.jsx" },
      { "key": "paren_pressed" }
  ]
}

Besides, I'm just wondering if this PR will be merged soon 😅 . Type completion for JavaScript files works perfectly in vscode, so I (and many other users) are looking forward to use this feature in sublime.

@james2doyle

This comment has been minimized.

Copy link

james2doyle commented Jul 5, 2018

Since the issue seems to have gone stale, I had to turn to the Sublime LSP plugin and a different language server to get plain .js files working properly.

You can read more about how I got this working on the LSP Plugin repo.

@ryanolsonx

This comment has been minimized.

Copy link

ryanolsonx commented Sep 21, 2018

Ping

@james2doyle

This comment has been minimized.

Copy link

james2doyle commented Dec 17, 2018

I think this is closed now due to #620

@DanielRosenwasser DanielRosenwasser deleted the supportJs branch Jan 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

9 participants
You can’t perform that action at this time.