Skip to content

Commit

Permalink
Resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
WillLillis committed Feb 11, 2024
1 parent 168bef4 commit fa36220
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
4 changes: 2 additions & 2 deletions lsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use htmx::HxCompletion;
use log::{debug, error, info, warn};
use lsp_types::{
CompletionItem, CompletionItemKind, CompletionList, HoverContents, InitializeParams,
LanguageString, MarkedString, MarkupContent, PositionEncodingKind, ServerCapabilities,
TextDocumentSyncCapability, TextDocumentSyncKind, WorkDoneProgressOptions,
MarkupContent, PositionEncodingKind, ServerCapabilities, TextDocumentSyncCapability,
TextDocumentSyncKind, WorkDoneProgressOptions,
};

use lsp_server::{Connection, Message, Response};
Expand Down
4 changes: 1 addition & 3 deletions lsp/src/text_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use lsp_textdocument::FullTextDocument;
use lsp_types::{Position, Range, TextDocumentPositionParams, Url};
use tree_sitter::{Parser, Tree};

// use crate::tree_sitter::Position;

pub struct DocInfo {
pub doc: FullTextDocument,
pub parser: Parser,
Expand Down Expand Up @@ -78,7 +76,7 @@ fn find_word_at_pos(line: &str, col: usize) -> (usize, usize) {

pub fn get_word_from_pos_params(pos_params: &TextDocumentPositionParams) -> anyhow::Result<String> {
let uri = &pos_params.text_document.uri;
let line = pos_params.position.line as usize;
let line = pos_params.position.line;
let col = pos_params.position.character as usize;

let range = Range {
Expand Down
11 changes: 3 additions & 8 deletions lsp/src/tree_sitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ use lsp_textdocument::FullTextDocument;
use lsp_types::{TextDocumentContentChangeEvent, TextDocumentPositionParams};
use tree_sitter::{InputEdit, Node, Point};

use crate::text_store::get_text_document;

#[derive(Debug, Clone, PartialEq)]
pub enum Position {
AttributeName(String),
Expand Down Expand Up @@ -108,8 +106,6 @@ pub fn get_position_from_lsp_completion(
text_params: TextDocumentPositionParams,
) -> Option<Position> {
error!("get_position_from_lsp_completion");
let text = get_text_document(&text_params.text_document.uri, None)?;
error!("get_position_from_lsp_completion: text {}", text);
let pos = text_params.position;
error!("get_position_from_lsp_completion: pos {:?}", pos);

Expand All @@ -120,13 +116,12 @@ pub fn get_position_from_lsp_completion(
.expect("text store mutex poisoned")
.get_mut(text_params.text_document.uri.as_str())
{
entry.tree = entry
.parser
.parse(entry.doc.get_content(None), entry.tree.as_ref());
let text = entry.doc.get_content(None);
entry.tree = entry.parser.parse(text, entry.tree.as_ref());

if let Some(ref curr_tree) = entry.tree {
let trigger_point = Point::new(pos.line as usize, pos.character as usize);
return query_position(curr_tree.root_node(), text.as_str(), trigger_point);
return query_position(curr_tree.root_node(), text, trigger_point);
}
}

Expand Down

0 comments on commit fa36220

Please sign in to comment.