Skip to content

Commit 66d2cf1

Browse files
authored
Merge pull request #192 from vim-denops/no-symbol
Fixed issue when multiple versions of libraries are referenced
2 parents fb160c7 + fb218f4 commit 66d2cf1

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

denops_std/buffer/buffer.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ import {
1515
import { tryDecode } from "./fileencoding.ts";
1616
import { generateUniqueString } from "../util.ts";
1717

18-
const cacheKey = Symbol("denops_std/buffer/buffer.ts");
19-
const suffix = generateUniqueString();
18+
const cacheKey = "denops_std/buffer/buffer.ts@1";
2019

2120
async function ensurePrerequisites(denops: Denops): Promise<string> {
22-
if (cacheKey in denops.context) {
23-
return suffix;
21+
if (typeof denops.context[cacheKey] === "string") {
22+
return denops.context[cacheKey];
2423
}
25-
denops.context[cacheKey] = true;
24+
const suffix = generateUniqueString();
25+
denops.context[cacheKey] = suffix;
2626
const script = `
2727
function! DenopsStdBufferOpen_${suffix}(bang, mods, opener, cmdarg, bufname) abort
2828
execute printf('%s %s%s %s \`=a:bufname\`', a:mods, a:opener, a:bang ? '!' : '', a:cmdarg)

denops_std/buffer/decoration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as nvimFn from "../function/nvim/mod.ts";
55
import * as itertools from "https://deno.land/x/itertools@v1.1.0/mod.ts";
66
import { unreachable } from "https://deno.land/x/unreachable@v0.1.0/mod.ts";
77

8-
const cacheKey = Symbol("denops_std/buffer/decoration/vimDecorate/rs");
8+
const cacheKey = "denops_std/buffer/decoration/vimDecorate/rs@1";
99

1010
export interface Decoration {
1111
// Line number

denops_std/function/getreginfo.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import { lt } from "https://deno.land/std@0.171.0/semver/mod.ts";
33
import { execute } from "../helper/mod.ts";
44
import { generateUniqueString } from "../util.ts";
55

6-
const cacheKey = Symbol("denops_std/function/getreginfo.ts");
7-
const suffix = generateUniqueString();
6+
const cacheKey = "denops_std/function/getreginfo.ts@1";
87

98
async function ensurePrerequisites(denops: Denops): Promise<string> {
10-
if (cacheKey in denops.context) {
11-
return suffix;
9+
if (typeof denops.context[cacheKey] === "string") {
10+
return denops.context[cacheKey];
1211
}
13-
denops.context[cacheKey] = true;
12+
const suffix = generateUniqueString();
13+
denops.context[cacheKey] = suffix;
1414
const script = `
1515
function! DenopsStdFunctionGetreginfo_${suffix}(...) abort
1616
let l:result = call('getreginfo', a:000)

denops_std/helper/echo.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import type { Denops } from "https://deno.land/x/denops_core@v4.0.0/mod.ts";
22
import { execute } from "./execute.ts";
33
import { generateUniqueString } from "../util.ts";
44

5-
const cacheKey = Symbol("denops_std/helper/echo");
6-
const cacheKeySilent = Symbol("denops_std/helper/echo/silent");
7-
const suffix = generateUniqueString();
5+
const cacheKey = "denops_std/helper/echo@1";
6+
const cacheKeySilent = "denops_std/helper/echo/silent@1";
87

98
async function ensurePrerequisites(denops: Denops): Promise<string> {
10-
if (cacheKey in denops.context) {
11-
return suffix;
9+
if (typeof denops.context[cacheKey] === "string") {
10+
return denops.context[cacheKey];
1211
}
13-
denops.context[cacheKey] = true;
12+
const suffix = generateUniqueString();
13+
denops.context[cacheKey] = suffix;
1414
const script = `
1515
let g:loaded_denops_std_helper_echo_${suffix} = 1
1616
let s:denops_std_helper_echo_timer = 0

denops_std/helper/input.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import * as anonymous from "../anonymous/mod.ts";
88
import { execute } from "./execute.ts";
99
import { generateUniqueString } from "../util.ts";
1010

11-
const cacheKey = Symbol("denops_std/helper/input");
12-
const suffix = generateUniqueString();
11+
const cacheKey = "denops_std/helper/input@1";
1312

1413
async function ensurePrerequisites(denops: Denops): Promise<string> {
15-
if (cacheKey in denops.context) {
16-
return suffix;
14+
if (typeof denops.context[cacheKey] === "string") {
15+
return denops.context[cacheKey];
1716
}
18-
denops.context[cacheKey] = true;
17+
const suffix = generateUniqueString();
18+
denops.context[cacheKey] = suffix;
1919
const script = `
2020
let s:loaded_denops_std_helper_input_${suffix} = 1
2121

0 commit comments

Comments
 (0)