feat: make --no-syntax just disable syntax highlighting and not language server support
This commit is contained in:
		
							parent
							
								
									5182756f1d
								
							
						
					
					
						commit
						f4dd30b1c2
					
				
					 2 changed files with 15 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -26,7 +26,7 @@ query: *Query,
 | 
			
		|||
injections: *Query,
 | 
			
		||||
tree: ?*treez.Tree = null,
 | 
			
		||||
 | 
			
		||||
pub fn create(file_type: *const FileType, allocator: std.mem.Allocator, content: []const u8) !*Self {
 | 
			
		||||
pub fn create(file_type: *const FileType, allocator: std.mem.Allocator) !*Self {
 | 
			
		||||
    const self = try allocator.create(Self);
 | 
			
		||||
    self.* = .{
 | 
			
		||||
        .allocator = allocator,
 | 
			
		||||
| 
						 | 
				
			
			@ -38,18 +38,17 @@ pub fn create(file_type: *const FileType, allocator: std.mem.Allocator, content:
 | 
			
		|||
    };
 | 
			
		||||
    errdefer self.destroy();
 | 
			
		||||
    try self.parser.setLanguage(self.lang);
 | 
			
		||||
    try self.refresh_full(content);
 | 
			
		||||
    return self;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub fn create_file_type(allocator: std.mem.Allocator, content: []const u8, lang_name: []const u8) !*Self {
 | 
			
		||||
pub fn create_file_type(allocator: std.mem.Allocator, lang_name: []const u8) !*Self {
 | 
			
		||||
    const file_type = FileType.get_by_name(lang_name) orelse return error.NotFound;
 | 
			
		||||
    return create(file_type, allocator, content);
 | 
			
		||||
    return create(file_type, allocator);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub fn create_guess_file_type(allocator: std.mem.Allocator, content: []const u8, file_path: ?[]const u8) !*Self {
 | 
			
		||||
    const file_type = FileType.guess(file_path, content) orelse return error.NotFound;
 | 
			
		||||
    return create(file_type, allocator, content);
 | 
			
		||||
    return create(file_type, allocator);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub fn destroy(self: *Self) void {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue