Skip to content

Commit

Permalink
rename add_global_context to add_link_hints
Browse files Browse the repository at this point in the history
  • Loading branch information
uros-5 committed Sep 4, 2024
1 parent 047f17c commit 06a429d
Show file tree
Hide file tree
Showing 19 changed files with 26 additions and 25 deletions.
4 changes: 2 additions & 2 deletions jinja-lsp-nodejs/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ export interface Action {
export class NodejsLspFiles {
constructor()
/** Actions can come from unsaved context. */
addGlobalContext(uri: string, actions?: Array<Action> | undefined | null): void
addLinkHints(uri: string, actions?: Array<Action> | undefined | null): void
deleteAll(filename: string): void
addOne(id: number, filename: string, content: string, line: number, ext: string, col?: number | undefined | null): Array<JsIdentifier>
getVariables(id: string, line: number): Array<JsIdentifier> | null
hover(id: number, filename: string, line: number, position: JsPosition): JsHover | null
complete(id: number, filename: string, line: number, position: JsPosition): Array<JsCompletionItem> | null
complete(id: number, filename: string, line: number, position: JsPosition, linkHints?: string | undefined | null): Array<JsCompletionItem> | null
gotoDefinition(id: number, filename: string, line: number, position: JsPosition): Array<JsLocation> | null
}
2 changes: 1 addition & 1 deletion jinja-lsp-nodejs/npm/android-arm-eabi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jinja-lsp/functions-android-arm-eabi",
"version": "0.0.18",
"version": "0.0.19",
"os": [
"android"
],
Expand Down
2 changes: 1 addition & 1 deletion jinja-lsp-nodejs/npm/android-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jinja-lsp/functions-android-arm64",
"version": "0.0.18",
"version": "0.0.19",
"os": [
"android"
],
Expand Down
2 changes: 1 addition & 1 deletion jinja-lsp-nodejs/npm/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jinja-lsp/functions-darwin-arm64",
"version": "0.0.18",
"version": "0.0.19",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion jinja-lsp-nodejs/npm/darwin-universal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jinja-lsp/functions-darwin-universal",
"version": "0.0.18",
"version": "0.0.19",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion jinja-lsp-nodejs/npm/freebsd-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jinja-lsp/functions-freebsd-x64",
"version": "0.0.18",
"version": "0.0.19",
"os": [
"freebsd"
],
Expand Down
2 changes: 1 addition & 1 deletion jinja-lsp-nodejs/npm/linux-arm-gnueabihf/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jinja-lsp/functions-linux-arm-gnueabihf",
"version": "0.0.18",
"version": "0.0.19",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion jinja-lsp-nodejs/npm/linux-arm-musleabihf/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jinja-lsp/functions-linux-arm-musleabihf",
"version": "0.0.18",
"version": "0.0.19",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion jinja-lsp-nodejs/npm/linux-arm64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jinja-lsp/functions-linux-arm64-gnu",
"version": "0.0.18",
"version": "0.0.19",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion jinja-lsp-nodejs/npm/linux-arm64-musl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jinja-lsp/functions-linux-arm64-musl",
"version": "0.0.18",
"version": "0.0.19",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion jinja-lsp-nodejs/npm/linux-riscv64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jinja-lsp/functions-linux-riscv64-gnu",
"version": "0.0.18",
"version": "0.0.19",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion jinja-lsp-nodejs/npm/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jinja-lsp/functions-linux-x64-gnu",
"version": "0.0.18",
"version": "0.0.19",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion jinja-lsp-nodejs/npm/linux-x64-musl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jinja-lsp/functions-linux-x64-musl",
"version": "0.0.18",
"version": "0.0.19",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion jinja-lsp-nodejs/npm/win32-arm64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jinja-lsp/functions-win32-arm64-msvc",
"version": "0.0.18",
"version": "0.0.19",
"os": [
"win32"
],
Expand Down
2 changes: 1 addition & 1 deletion jinja-lsp-nodejs/npm/win32-ia32-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jinja-lsp/functions-win32-ia32-msvc",
"version": "0.0.18",
"version": "0.0.19",
"os": [
"win32"
],
Expand Down
2 changes: 1 addition & 1 deletion jinja-lsp-nodejs/npm/win32-x64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jinja-lsp/functions-win32-x64-msvc",
"version": "0.0.18",
"version": "0.0.19",
"os": [
"win32"
],
Expand Down
4 changes: 2 additions & 2 deletions jinja-lsp-nodejs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion jinja-lsp-nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jinja-lsp/functions",
"version": "0.0.18",
"version": "0.0.19",
"main": "index.js",
"types": "index.d.ts",
"napi": {
Expand Down
11 changes: 6 additions & 5 deletions jinja-lsp-nodejs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl NodejsLspFiles {

/// Actions can come from unsaved context.
#[napi]
pub fn add_global_context(&mut self, uri: String, actions: Option<Vec<Action>>) {
pub fn add_link_hints(&mut self, uri: String, actions: Option<Vec<Action>>) {
if let Some(actions) = actions {
let mut identifiers = vec![];
let mut action_objects = vec![];
Expand Down Expand Up @@ -315,6 +315,7 @@ impl NodejsLspFiles {
filename: String,
line: u32,
mut position: JsPosition,
link_hints: Option<String>,
) -> Option<Vec<JsCompletionItem>> {
position.line -= line;
let original_uri = filename.to_string();
Expand Down Expand Up @@ -358,10 +359,10 @@ impl NodejsLspFiles {
}

CompletionType::Identifier => {
if let Some(variables) =
self
.lsp_files
.read_variables(&uri, position, None, Some(original_uri.to_string()))
let url = link_hints.unwrap_or(original_uri.to_string());
if let Some(variables) = self
.lsp_files
.read_variables(&uri, position, None, Some(url))
{
let mut ret = vec![];
for item in variables {
Expand Down

0 comments on commit 06a429d

Please sign in to comment.