Commit Graph

148 Commits

Author SHA1 Message Date
Antonio Scandurra
534f038631 Don't use atom globals in TokenIterator 2015-10-07 15:25:02 -05:00
Antonio Scandurra
df2d73a8df Don't use atom globals in TokenizedBuffer 2015-10-07 15:25:02 -05:00
Nathan Sobo
122bf72c75 Don’t use atom.packages global in TokenizedBuffer 2015-10-07 15:25:00 -05:00
Nathan Sobo
b2359f44a6 Don’t use atom.grammars global in TokenizedBuffer 2015-10-07 15:25:00 -05:00
Nathan Sobo
4f65452902 Don’t use atom.config global in TokenizedBuffer 2015-10-07 15:24:59 -05:00
Nathan Sobo
dc0709ef9e Don’t use atom.assert global in DisplayBuffer 2015-10-07 15:24:59 -05:00
Nathan Sobo
4a1d1fdffb Don’t use Serializable mixin in TokenizedBuffer 2015-09-22 10:37:15 -06:00
Nathan Sobo
a8c77ae91f 🔥 Remove grim require from TokenizedBuffer 2015-09-22 10:37:09 -06:00
Max Brunsfeld
30d8216bf6 Merge branch 'master' into mb-custom-extension-grammar-map
Conflicts:
	package.json
2015-08-12 17:31:15 -07:00
Nathan Sobo
eb4944b07d Make bufferRangeForScopeAtPosition work with last column of scope 2015-08-10 14:21:23 -06:00
Max Brunsfeld
989bb86199 Start work on custom scope -> filetypes configuration 2015-07-30 17:39:55 -07:00
Nathan Sobo
f254c46a62 Keep popping scopes until we find a matching start scope tag 2015-07-17 11:10:09 -07:00
Nathan Sobo
c7d99140b9 Merge pull request #7638 from atom-community/jf-dispatch-grammar-used
Add activationHooks + Trigger `{grammar-package-name}:grammar-used` Hook When A text-editor-element's Grammar Is Set
2015-07-09 15:42:31 -05:00
Nathan Sobo
4567601ae9 Maintain change counts for debugging purposes
When we have an unexpected display-buffer or tokenized-buffer state,
we can include the change counts to make sure that every change to the
buffer has been processed by display-buffer and tokenized-buffer. If
they haven’t, there’s something wrong with our event ordering. If they
have, there’s a logic error somewhere else.
2015-07-09 02:18:24 -05:00
Nathan Sobo
028acbcae4 Don’t call method to read stack
If the line is undefined, we want the stack to be null.
2015-07-09 01:51:36 -05:00
Joe Fitzgerald
b3b046aa66 Add activationHooks To package.json
- Trigger the `{grammar-package-name}:grammar-used` hook when grammar is set for tokenized-buffer
2015-07-09 02:33:17 -04:00
Nathan Sobo
587e898867 Remove assertion since we call this with out of range rows legitimately 2015-07-09 00:28:46 -05:00
Nathan Sobo
a352a2ca61 Try to avoid exceptions due to undefined lines in TokenizedBuffer 2015-07-09 00:13:06 -05:00
Nathan Sobo
b953a11fa5 Clip positions in TokenizedBuffer::scopeDescriptorForPosition 2015-07-08 17:06:05 -05:00
Nathan Sobo
54549f916a Change assertion API to pass error to callback
Don’t assume anything about metadata. Just give assertion callers access
to the error object.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2015-07-07 19:29:23 -05:00
Nathan Sobo
e529d1e345 Request contents of buffer when first-mate tags are in a corrupt state 2015-07-01 16:46:09 -05:00
Nathan Sobo
8ea36a6ac5 In invalid scope exception: include grammar metadata, ask for details 2015-07-01 13:59:47 -05:00
Nathan Sobo
8b088926bb Merge pull request #7602 from atom/ns-mixed-indent
Restore support for mixed tabs and spaces in line indentation
2015-06-30 15:54:47 -05:00
Nathan Sobo
82e25872b2 Handle indentation with mixed tabs and spaces 2015-06-30 15:31:11 -05:00
Nathan Sobo
5d957b677b Revert "Merge pull request #7373 from atom/revert-7350-ns-assertions"
This reverts commit 1a3441a503, reversing
changes made to 1aab5e74d9.
2015-06-30 15:30:58 -05:00
Nathan Sobo
b6d099ac78 Consider tabs or spaces mutually exclusively as indentation
Previously, we allowed a mix of tabs and spaces to be counted toward the
indentation of a line. This caused problems when auto-indenting lines in
a hard-tabbed file that contained “alignment spaces”, such as occurs in
aligned comment blocks. For this case, it makes more sense to assume
that the line is indented via tabs only, and consider the subsequent
alignment space as part of the line’s content. Since it’s hard to
imagine actual source code in which a mixed treatment of tabs and spaces
is desirable, I’m going with this over any more complex approach.
2015-06-29 17:05:28 -05:00
Nathan Sobo
b7a8ddd153 Revert "Add assertion mechanism" 2015-06-22 14:27:05 -05:00
Nathan Sobo
64fca5db20 Absorb exception in isFoldableCodeAtRow and report assertion failure
Can’t figure out what’s going on in this bug, but we can hopefully make
it less damaging and collect more information via the new assertion
system.

Refs #5905
2015-06-20 18:37:53 +02:00
Nathan Sobo
6bba381393 Merge pull request #7130 from atom/ns-large-file-mode
Load large files with fewer features but much better performance
2015-06-06 00:05:27 +02:00
Nathan Sobo
48ce361bd0 Select grammars based on first 10 lines of content, not the entire file 2015-06-05 22:24:49 +02:00
Nathan Sobo
56273e7eef Preserve large file mode across serialization and pane splits 2015-06-05 21:44:23 +02:00
Nathan Sobo
639647d115 Disallow fold creation in large file mode 2015-06-05 21:31:06 +02:00
Nathan Sobo
53a3239379 Use buffer coordinates in TokenizedBuffer::scopeDescriptorForPosition
Fixes #7073
2015-06-05 18:18:42 +02:00
Nathan Sobo
de508db9b2 Implement basic large file mode for editor
* Don’t tokenize
* Don’t build metadata to support folds and soft wraps

Remaining issues:

* Max line length is hard coded
* Foldable indicators should be disabled
* Folding via API should be disallowed
2015-06-05 02:25:57 +02:00
Nathan Sobo
5b494b7b17 Lazily construct placeholder lines in TokenizedBuffer 2015-06-05 02:22:44 +02:00
Nathan Sobo
31cf19a205 Use previous definition of scope selector match to fix API breakage
I switched to first-mate Selector because I didn’t want to replicate
the poorly-defined Token::matchesScopeSelector method now that tokens
are not stored on lines. However, the first-mate semantics are stricter
and that broke the API. Perhaps using selector-kit here would be better,
but I just wanted to put back exactly to how it was for now.

/cc @ypresto
2015-05-28 10:38:35 +02:00
Nathan Sobo
2379b3803f Revert "Revert "Merge pull request #6757 from atom/ns-less-memory-for-tokens""
This reverts commit 7cb0bc3bc2.
2015-05-21 19:56:52 +02:00
Nathan Sobo
7cb0bc3bc2 Revert "Merge pull request #6757 from atom/ns-less-memory-for-tokens"
This reverts commit 0cd1f110b5, reversing
changes made to d75d202d33.

Conflicts:
	package.json
2015-05-21 16:25:23 +02:00
Nathan Sobo
2beb6c0fe0 Pass TokenIterator reference instead of using global singleton
Adds an extra reference to each tokenized line but is also more sane.

/cc @maxbrunsfeld
2015-05-20 19:29:38 +02:00
Nathan Sobo
564d75c534 ⬆️ first-mate 2015-05-19 17:22:25 +02:00
Nathan Sobo
0c153a298e Use scope of last token if we iterate off the end 2015-05-16 00:46:31 +02:00
Nathan Sobo
4b5b64f782 Return scopes at very end of token for the last token on a line 2015-05-16 00:06:52 +02:00
Nathan Sobo
ec4c453b87 ⬆️ first-mate 2015-05-14 23:08:02 +02:00
Nathan Sobo
e694b18ae2 Merge branch 'master' into ns-less-memory-for-tokens
Conflicts:
	spec/tokenized-buffer-spec.coffee
	src/tokenized-buffer.coffee
2015-05-14 18:55:16 +02:00
Nathan Sobo
ac5a5d5ba0 Remove unused TokenizedBuffer methods that relied on tokens shim 2015-05-14 17:51:46 +02:00
Max Brunsfeld
31c1ac412b 🎨 remove duplication in TokenizedBuffer::setGrammar 2015-05-13 21:23:20 -07:00
Max Brunsfeld
19d905606b Avoid double computation of screen lines when opening files
Previously, instantiating a TextEditor would always compute compute
screen lines twice: once when the DisplayBuffer was instantiated,
and once when the 'invisibles' property was set on the DisplayBuffer.
2015-05-13 19:59:25 -07:00
Nathan Sobo
64c0ef8bd8 Remove more usages of tokens shim 2015-05-14 01:46:49 +02:00
Nathan Sobo
6b51b5d02a Rename parentScopes to openScopes 2015-05-13 21:17:46 +02:00
Nathan Sobo
a8d01bcec1 Fix bufferRangeForScopeAtPosition with new tags array scheme 2015-05-13 21:17:45 +02:00