cleaned up warnings and added javascript

This commit is contained in:
KCaverly 2023-07-11 16:41:08 -04:00
parent debe6f107e
commit 2ca4b3f4cc
4 changed files with 68 additions and 3 deletions

View file

@ -1,4 +1,4 @@
use std::{ops::Range, path::PathBuf, sync::Arc, time::SystemTime};
use std::{path::PathBuf, sync::Arc, time::SystemTime};
use anyhow::{anyhow, Ok, Result};
use project::Fs;
@ -61,6 +61,8 @@ impl CodeContextRetriever {
tree.root_node(),
content.as_bytes(),
) {
// log::info!("-----MATCH-----");
let mut name: Vec<&str> = vec![];
let mut item: Option<&str> = None;
let mut offset: Option<usize> = None;
@ -89,6 +91,12 @@ impl CodeContextRetriever {
.replace("<language>", &pending_file.language.name().to_lowercase())
.replace("<item>", item.unwrap());
let mut truncated_span = context_span.clone();
truncated_span.truncate(100);
// log::info!("Name: {:?}", name);
// log::info!("Span: {:?}", truncated_span);
context_spans.push(context_span);
documents.push(Document {
name: name.join(" "),

View file

@ -386,7 +386,8 @@ impl VectorStore {
let (parsing_files_tx, parsing_files_rx) = channel::unbounded::<PendingFile>();
let mut _parsing_files_tasks = Vec::new();
for _ in 0..cx.background().num_cpus() {
// for _ in 0..cx.background().num_cpus() {
for _ in 0..1 {
let fs = fs.clone();
let parsing_files_rx = parsing_files_rx.clone();
let batch_files_tx = batch_files_tx.clone();

View file

@ -0,0 +1,56 @@
; (internal_module
; "namespace" @context
; name: (_) @name) @item
(enum_declaration
"enum" @context
name: (_) @name) @item
(function_declaration
"async"? @context
"function" @context
name: (_) @name) @item
(interface_declaration
"interface" @context
name: (_) @name) @item
; (program
; (export_statement
; (lexical_declaration
; ["let" "const"] @context
; (variable_declarator
; name: (_) @name) @item)))
(program
(lexical_declaration
["let" "const"] @context
(variable_declarator
name: (_) @name) @item))
(class_declaration
"class" @context
name: (_) @name) @item
(method_definition
[
"get"
"set"
"async"
"*"
"readonly"
"static"
(override_modifier)
(accessibility_modifier)
]* @context
name: (_) @name) @item
; (public_field_definition
; [
; "declare"
; "readonly"
; "abstract"
; "static"
; (accessibility_modifier)
; ]* @context
; name: (_) @name) @item

View file

@ -1,6 +1,6 @@
; (internal_module
; "namespace" @context
name: (_) @name) @item
; name: (_) @name) @item
(enum_declaration
"enum" @context