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

js3-indent-tabs-mode doesn't seem to be respected in .dir-locals.el #105

Open
mattdeboard opened this issue Oct 1, 2014 · 6 comments
Open
Labels

Comments

@mattdeboard
Copy link

So I'm working on a project that uses tabs instead of spaces. Normally I can set up my .dir-locals.el like so:

((nil . (indent-tabs-mode . t)
        (whitespace-action . nil)))

and tabs will be used instead of spaces. However it seems as though this is not the case with js3-mode. I'm doing the following:

((nil . (js3-indent-tabs-mode . t)
        (whitespace-action . nil)))

but pressing <TAB> still inserts spaces. Also, when I do this, then check the value of the variable with C-h v js3-indent-tabs-mode, it still reports as nil. So I threw that out and just added the following to the top of the file:

// -*- js3-indent-tabs-mode: t -*-

Now C-h v js3-indent-tabs-mode reports its buffer-local value is t. But when I hit <TAB>, it's still inserting spaces. So just on a lark, I updated the file header to:

// -*- js3-indent-tabs-mode: t js3-manual-indentation: t -*-

Now <TAB> inserts TAB characters, but it of course only inserts one. So that's half a solution. Ideally though I could still have auto-indentation AND insert TAB characters instead of spaces.

I'm on v1.1.0, Emacs 24.4.50

@mattdeboard
Copy link
Author

Also, hi @plumlee, I saw you commenting on #100

@tamzinblake
Copy link
Owner

I'm not sure how auto-indentation would even work with tabs in js3-mode. Currently it's designed to do a lot of "lining things up" for the most part. You might want to look at js2-mode, which will soon use the indentation from js-mode by default.

@tamzinblake tamzinblake added the Bug label Oct 1, 2014
@plumlee
Copy link

plumlee commented Oct 1, 2014

Heya @mattdeboard. You could also use spaces, but tabify on a save? But that's a pretty ugly hack.

@mattdeboard
Copy link
Author

Yeah I just switched to js2-mode. Seems fine for now, but js3-mode is so much faster parsing large files.

@tamzinblake
Copy link
Owner

@mattdeboard I also saw that here mooz/js2-mode#163

I don't understand how js2-mode is slower than js3-mode at parsing. I've made some changes to the parser but it's still basically the same, and I haven't seen much change on their end either. It would be interesting if this is because I yanked out the XML stuff or something.

If this is because of something we're doing well here rather than a bug I haven't fixed or something, we should see if we can fix js2-mode to not be slow.

@mattdeboard
Copy link
Author

Unfortunately I can't really give you the example I'm going from since it's proprietary code, but the upshot is it's the result of compiling a whole bunch of coffeescript files into a single JS file (via requirejs). The resulting file is about 61k lines of JS, not uglified or minified. Takes 10-15s for js2-mode to load it up, apply syntax highlighting and free up the process to the user. js3-mode takes ~5s if that.

And it's extremely sluggish moving through the file even after it's fully loaded. It smells like a whole lot of parsing of the whole file over and over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants