- Updated
Workspace::update_current_syntax
method to match against buffer file names when an extension isn't present, enabling support for formats likeMakefile
. Since this method is called byWorkspace::open_buffer
andWorkspace::add_buffer
, these methods will now correctly apply syntax definitions when available.
- Add new
Workspace::buffer_paths
method to list all buffer paths in the workspace. - Add new
Workspace::current_buffer_index
method, which when combined with thebuffer_paths
method above, can be used to highlight the current buffer filename and/or path.
- Rename
Buffer::replace_content
method to justreplace
- Re-implement
replace
as a proper operation, allowing it to be undone/redone - Fix an issue from
0.8.3
whereBuffer::reload
would leave buffer flagged as modified
- Add new
Buffer::replace_content
method to replace all content in-place - Updated
Buffer::reload
to raise an error when path is missing - Updated
GapBuffer::new
to accept bothString
and&str
- Update Buffer
reload
method to preserve cursor position or line when possible. - Replace GapBuffer
to_string
method withfmt::Display
trait implementation.
- Removed unused luthor dependency
- Upgrade unicode-segmentation dependency
- Use semver-based dependency format
Lots of changes, some of which break public APIs. Almost all of these are related to a syntect upgrade, which jumps three major versions, from v2 to v5.
- Buffer::tokens(&self)
- Buffer::current_scope(&self)
- Workspace::current_buffer(&mut self)
- Workspace::contains_buffer_with_path(&self, &Path) -> bool
- Buffer::file_extension(&self) -> Option
- Workspace::current_buffer_tokens(&'a self) -> Result<TokenSet<'a>>
- TokenSet::new(String, &'a SyntaxDefinition) -> TokenSet<'a>
- is now TokenSet::new(String, &'a SyntaxReference, &'a SyntaxSet) -> TokenSet<'a>
- TokenSet::iter(&self) -> TokenIterator
- is now TokenSet::iter(&self) -> Result
- TokenIterator::new(&'a str, &'a SyntaxDefinition) -> TokenIterator<'a>
- is now TokenIterator::new(&'a str, &'a SyntaxReference, &'a SyntaxSet) -> Result<TokenIterator<'a>>
- Workspace::new(&Path) -> Result
- is now Workspace::new(&Path, Option<&Path>) -> Result to allow loading user syntax definitions during construction
Tokenization previously only required a syntax definition, but now requires a SyntaxSet too. As a result, buffers are no longer able to produce a TokenSet using only their own fields. Given this added dependency, setting up tokenization is now the responsibility of Workspace::current_buffer_tokens.
Accessing the workspace's current buffer was previously done using Workspace::current_buffer(&mut self). Despite the encapsulation benefits this accessor approach provides, Rust isn't smart enough to infer that we're only borrowing one field, and the entire workspace is borrowed for the given lifetime. This was incompatible with the new tokenization requirements, which use both the syntax set from the workspace and the definition from the buffer; calling current_buffer() on the workspace would make accessing its syntax_set impossible.
To solve this, the current buffer is now accessed directly as a field.
Syntect now returns proper errors instead of panicking. To make proper use of these, the TokenIterator type has been updated to handle Result-based returns. When an error is discovered, iteration is halted, and the error is stored in a public field on the iterator. This allows consumers to check for errors after iterating, rather than on every returned value during iteration.
- Renamed Distance type's
from_str
method toof_str
, to prevent ambiguity with the standard library FromStr trait method.
- Add
update_current_syntax
method to theWorkspace
type, to re-attempt assigning a syntax definition to the current buffer. This is most useful when a buffer path changes, and the new path can provide a more appropriate definition.
- Add
change_callback
field to theBuffer
type, to facilitate cache invalidation implementations. When specified, this closure will be called whenever buffer data changes.
- Updated syntect dependency to 2.1.0.
- Expose the LineIterator type, which includes trailing newlines. This is
required when using the
syntect
crate to highlight a buffer, as its line parser expects these.
- Updated documentation links and README.
- Implemented the Add and AddAssign operation traits for Position.
- The latter replaces the previous self-mutating add method.
- Derived Copy and Clone traits for Distance type.
- Dropped mutable borrow for buffer search.
- Fixed an issue with
TokenIterator
where position offsets were byte-based rather than grapheme cluster-based, which is the contract/convention applied throughout the rest of the library.
- Expose the
Workspace
type'ssyntax_set
field. This allows augmenting the default syntax definition set with additional entries.
- Updated syntect dependency to 1.7.1.
- Added a new current_scope method to the Buffer type, which will return the scope stack at the cursor position.
- Updated the Buffer tokens method to return a MissingSyntaxDefinition error when a syntax hasn't been configured for the buffer. This will provide more context to consumers when we're unable to return a TokenSet.
- Updated syntect dependency to 1.3.0.
- Fixed an issue with the token iterator where, under certain circumstances, trailing newline characters would be included in a lexeme.
- Updated workspace current_buffer_path method to return the buffer path as-is when it cannot be represented relative to the workspace.
- Updated dependency specifications to lock both major and minor versions.
- Updated syntect dependency to 1.0.4.
- Remove print call in insert operation reverse method (for shame)
- Updated gap buffer, cursor, and insert operation types to support grapheme clusters.
- Cleaned up buffer save method error handling.
- Migrated token lexers to syntect-based implementation.
- The tokens method now yields a lazily-executed iterable type.
- The Token type now contains a position and scope stack (rather than category).
- Updated Workspace and Buffer types to canonicalize their paths.
- Added a current_buffer_path method to the Workspace type, which returns a path relative to the workspace.
- Replaced Optionio::Error returns with proper Result types.
- Fixed an issue where reloading a buffer would not persist its ID.
- Added a Position constructor.
- Added Distance relative/vector type.
- Updated Position type to support adding Distances (via add method).
- Added reload method to buffer type.
- Fixed buffer doc tests for modified and line_count methods.
- Update buffer line_count method to handle trailing newlines.
- Removed caching from buffer type's
data
andtokens
methods, removing mutability requirements. - Added line_count method to buffer type.
- Updated insert operation to use Into trait rather than converting &str -> String.
- Added
id
field to buffer type. - Updated workspace to populate buffer
id
field with a unique value when added to the workspace.
- Changed workspace open/close buffer methods to work relative to current buffer.
- Implement prefix matching without use of unstable pattern feature.
- Added modification tracking to buffers.
- Renamed start/end of buffer cursor movement methods.
- Add mutable dereferencing to buffer cursor type.
- Update all types to use type-scoped constructor idiom (e.g. Buffer::new() instead of buffer::new()).
- Add workspace open_buffer method to add a buffer by path, also guarding against adding a buffer with the same path as an existing one.
- Add cursor methods for moving to start and end of buffer.
- Update luthor dependency to v0.1.4.
- Fixed an issue where searching a buffer with multi-byte unicode characters would panic due to incorrect/non-byte-offset slicing.
- Fixed an issue where reversing an insert operation with a trailing newline character would remove more data than was inserted.
- Fixed various line length calculations incorrectly using byte lengths instead of character counts.
- Added a read method to Buffer type for reading arbitrary ranges.
- Removed is_valid method from Range type.
- Privatized Range type fields, added a constructor, as well as accessor methods. This is to guarantee that start and end fields are in the correct order.
- Fixed an issue where reading from a gap buffer when the gap is at the start of the requested range would return the content prefixed with the gap contents.
- Updated gap buffers to gracefully handle delete ranges that extend beyond a line's last column or the end of the document.
- Fixed target gap offset resolution introduced in v0.2.4, which did not handle all cases.
- Updated gap buffer to move gap to the end of the buffer before reallocating. This prevents a split/two-segment gap when inserting enough data at the start to trigger a reallocation.
- Drop empty operation groups when explicitly ended via end_operation_group or implicitly via undo.