frontmacs
frontmacs copied to clipboard
Different ac behaviour on js and ts files
Hello again! Sorry to spam you guys like this. :D
As I am more then happy editing a new .tsx / .ts project, but I happened to be maintaining some older JS code also.
And now emacs behaves differently. No auto complete and no docs over functions. I know VsCode made me spoiled by providing the same linting for both .js and .ts files, am I asking to much expecting it to behave the same?
Inside a .tsx file if I type console.
I get the following suggestions:
The same if the file is a .ts:
But inside a .js (also jsx) file:
My modes:
Inside JS(X) files:
RJSX mode defined in ‘rjsx-mode.el’:
Major mode for editing JSX files.
Enabled minor modes: All-The-Icons-Completion All-The-Icons-Ibuffer
All-The-Icons-Ivy-Rich Auto-Composition Auto-Compression
Auto-Encryption Blink-Cursor Centaur-Tabs Column-Number Cursor-Sensor
Display-Line-Numbers Doom-Modeline Electric-Indent File-Name-Shadow
Flycheck Flycheck-Pos-Tip Font-Lock Git-Gutter Global-Auto-Complete
Global-Eldoc Global-Font-Lock Ivy Js2-Refactor Line-Number Mini-Frame
Mouse-Wheel Prettier-Js Shell-Dirtrack Smartparens Tooltip
Transient-Mark Treemacs-Filewatch Treemacs-Follow
Treemacs-Fringe-Indicator Treemacs-Git Xterm-Mouse Yas
Inside TS(X) files:
Web mode defined in ‘web-mode.el’:
Major mode for editing web templates.
Enabled minor modes: All-The-Icons-Completion All-The-Icons-Ibuffer
All-The-Icons-Ivy-Rich Auto-Complete Auto-Composition Auto-Compression
Auto-Encryption Blink-Cursor Centaur-Tabs Column-Number Company
Display-Line-Numbers Doom-Modeline Eldoc Electric-Indent
File-Name-Shadow Flycheck Flycheck-Pos-Tip Font-Lock Git-Gutter
Global-Auto-Complete Global-Eldoc Global-Font-Lock Ivy Line-Number
Mini-Frame Mouse-Wheel Prettier-Js Shell-Dirtrack Smartparens Tide
Tide-Hl-Identifier Tooltip Transient-Mark Treemacs-Filewatch
Treemacs-Follow Treemacs-Fringe-Indicator Treemacs-Git Xterm-Mouse
For comparison, on both js(x) and ts(x) inside VSCode:
@LionyxML We actually used tide
for .ts
and .tsx
and js2-refactor-mode
for js
. But really, we should be using those for both. I just haven't gotten around to it because I don't really do much .js
coding these days.
Would it be acceptable to put a jsconfig.json
in your project, and typescript language server in your package dependencies?
https://github.com/ananthakumaran/tide#javascript
If so, we could see if that file exists, and then load tide in stead of a vanilla JS environment.
GitHub
Tide - TypeScript Interactive Development Environment for Emacs - GitHub - ananthakumaran/tide: Tide - TypeScript Interactive Development Environment for Emacs
Hello again! Sorry to spam you guys like this. :D
Oh, and no need to apologize ever. Really appreciate ways that this can be improved.
Hello there!
I asked around about having a fallback for when jsconfig.json or tsconfig.json is not present into the directory, but I guess I am too dumb to understand the reason (lol).
In short. For projects I maintain, it is ok to do so. For projects I do not have any decision power, I will probably have to manage it locally.
I would love this feature, but I do not think it is for everyone (due to jsconfig mandatory presence), it might be some option to set in frontside custom-group.
Points to VSCode in this regard. If no config is present, it runs typescript in the background using its own defaults.
I asked around about having a fallback for when jsconfig.json or tsconfig.json is not present into the directory, but I guess I am too dumb to understand the reason (lol).
There are a couple of reasons.
- on javascript projects, generally, there is no dependency on
typescript
in package.json. As a result, you can't even start the tsserver because where is the actual js code to do so? - without a
jsconfig.json
how can you know which typescript compiler options to use?
Maybe we can have defaults for these? Not sure how that could work...