Comments (9)
In csharp-mode we are experimenting on a complete rewrite based on tree-sitter-mode, which gives us a real AST to work with.
The results there have been very promising.
If we were to fix all those small issues we have here, without creating some insane complexity in the lisp-code, I believe we may have to consider doing the same.
from typescript.el.
Yeah, I noticed that they are broken a while back. I thought I might need to fix them in order to fix an indentation issue but it turned out that I did not need them. I've not spent time fixing them because their brokenness does not have an actual impact on my work.
Using git blame
it looks like nobody spent any time on them. They are probably exactly like their counterpart in js-mode
and so have no TypeScript-specific knowledge.
I suspect they are going to get fixed when they become a real obstacle to someone's work. When that happens, whoever fixes them may want to think about biting the bullet to get the mode to use an AST. The fact of the matter is that TS allows for really complex code structures that would probably throw off the kind of logic that just looks around (point)
to figure what is going on. I mean, stuff like this is legit, except for the return undefined
(I did not feel like writing a proper return value):
class Q<X> {
}
function glerb(a: any = new class extends Object {
private x = 1;
moo(): void {
}
}): Q<{
a: 1,
b: () => void,
}> {
return undefined;
}
And I'm just scratching the surface of what TS allows.
from typescript.el.
Makes sense. Thanks for the details.
from typescript.el.
I encountered same issue. Is there anybody who is working on fixing this issue?
from typescript.el.
I have similar problems, using the beginning-of-defun
and end-of-defun
implicitly with narrow-to-defun
.
Another place where beginning/end of defun completely fails is lambda functions () => "I'm a a result"
or named lambda functions const getTheAnswer = () => 42
.
I don't know enough emacs lisp to be of any help, though...
from typescript.el.
@josteink from what I understand tree-sitter only supports highlighting? does it support other functions like mark-sexp, end-of-defun etc? which is more related to movement. I actually want to use tree-sitter for movement functionality, but can't find any reference or how to use it.
from typescript.el.
@josteink from what I understand tree-sitter only supports highlighting? does it support other functions like mark-sexp, end-of-defun etc? which is more related to movement. I actually want to use tree-sitter for movement functionality, but can't find any reference or how to use it.
Tree-sitter supports navigation based on AST knowledge.
Based on this it is fairly trivial to create move-to-beginning-of-defun functions.
See this issue in csharp-mode for an example: emacs-csharp/csharp-mode#219
The discovery there though was that pretty much all of those functions can be generalised for all tree-sitter based major-modes so we decided we should try to get such functions upstreamed rather than implement it in a major-mode specific way.
from typescript.el.
sweet, tree-sitter-node-at-point
this is what I am looking for.
from typescript.el.
So... We're rewriting typescript-mode
to be tree-sitter-mode
based too now? 😁
If so, I would suggest taking a look at csharp-tree-sitter-mode
as a whole, and start from scratch based on something like that (sans grammar-portion), instead of incrementally trying to rewrite what we have.
Edit: it seems like tree-sitter-langs
-package already contains typescript-grammar.
So ... What's left for us to do then? 😄
from typescript.el.
Related Issues (20)
- typescript-beginning-of-defun misses ES2015 forms HOT 2
- can't seem to indent props in JSX expression HOT 1
- Consider migrating CI to something not Travis HOT 5
- Symbol’s value as variable is void: compilation-error-regexp-alist-alist HOT 4
- Indentation hangs in `typescript--backward-to-parameter-list` when previous function has unbalanced parens
- typescript-mode hangs if I enter a newline after a dot character.
- File mode specification error: (void-function -compose) HOT 3
- typescript new keyword 'override' highlight HOT 2
- M-j in /** foo */ comment blocks is broken. Reasonbly easy to fix HOT 3
- Bump Version Tag HOT 8
- const, let formatting with multiple lines HOT 1
- Missing debugger keyword HOT 1
- Freeze on indenting dot after comma HOT 1
- `typescript-mode` is failing to download HOT 4
- Incorrect highlighting of keywords on latest commit HOT 5
- Adding mechanisms in place not to collide with in-tree typescript-mode HOT 7
- typescript 4.9 - satisfies operator HOT 1
- No option to achieve desired formatting HOT 1
- typescript--backward-to-parameter-list can cause multi-second delays in large files HOT 4
- Diagnostics don't show until file is changed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript.el.