Skip to content

Commit 31504c7

Browse files
authored
Merge pull request #164 from Shougo/import-map
Import map support
2 parents 386f563 + eef9d0c commit 31504c7

File tree

22 files changed

+263
-139
lines changed

22 files changed

+263
-139
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: ''
4+
title: ""
55
labels: bug
6-
assignees: ''
6+
assignees: ""
77
---
88

99
**Warning: I will close the issue without the minimal init.vim and the

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4-
title: ''
5-
labels: ''
6-
assignees: ''
4+
title: ""
5+
labels: ""
6+
assignees: ""
77
---
88

99
**Is your feature request related to a problem? Please describe.** A clear and

.github/workflows/deno.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: deno
22

33
env:
4-
DENO_VERSION: 1.x
4+
DENO_VERSION: 2.x
55
DENOPS_PATH: "./"
66

77
on:
@@ -46,3 +46,14 @@ jobs:
4646
run: |
4747
grep -rl Deno.test denops| xargs deno test --unstable -A
4848
timeout-minutes: 5
49+
50+
deno-test-publish:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
- uses: denoland/setup-deno@main
55+
with:
56+
deno-version: ${{ env.DENO_VERSION }}
57+
58+
- name: Test Publish
59+
run: deno task test:publish

.github/workflows/jsr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: jsr
22

33
env:
4-
DENO_VERSION: 1.x
4+
DENO_VERSION: 2.x
55

66
on:
77
push:
@@ -19,9 +19,9 @@ jobs:
1919
- uses: actions/checkout@v4
2020
with:
2121
fetch-depth: 0
22-
- uses: denoland/setup-deno@v1
22+
- uses: denoland/setup-deno@v2
2323
with:
2424
deno-version: ${{ env.DENO_VERSION }}
2525
- name: Publish
2626
run: |
27-
deno run -A jsr:@david/publish-on-tag@0.1.3
27+
deno run -A jsr:@david/publish-on-tag@0.2.0

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ completion](https://user-images.githubusercontent.com/41495/135711007-8c24c606-2
5353

5454
## Install
5555

56-
**NOTE:** Ddc.vim requires Vim 9.1.0448+ or Neovim 0.10.0+. See
56+
**NOTE:** It requires Vim 9.1.0448+ or Neovim 0.10.0+. See
5757
[requirements](#requirements) if you aren't sure whether you have this.
5858

5959
### Requirements
6060

61-
Please install both Deno 1.45+ and "denops.vim" v7.0+.
61+
Please install both Deno 2.3.0+ and "denops.vim" v8.0+.
6262

6363
- <https://deno.land/>
6464
- <https://github.com/vim-denops/denops.vim>

autoload/ddc/denops.vim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ function ddc#denops#_init(opts = {}) abort
33
return
44
endif
55

6-
if !has('patch-9.1.0448') && !has('nvim-0.10')
6+
if !has('patch-9.1.1646') && !has('nvim-0.11')
77
call ddc#util#print_error(
8-
\ 'ddc requires Vim 9.1.0448+ or neovim 0.10.0+.')
8+
\ 'ddc requires Vim 9.1.1646+ or neovim 0.11.0+.')
99
return
1010
endif
1111

1212
augroup ddc
1313
autocmd!
14-
autocmd InsertLeave * ++nested call ddc#hide('InsertLeave')
14+
autocmd ModeChanged *:n ++nested call ddc#hide('ModeChanged')
1515
augroup END
1616

1717
let context_filetype = a:opts->get('context_filetype', 'none')
@@ -66,7 +66,7 @@ function ddc#denops#_request(method, args, default=v:null) abort
6666
\ denops#request('ddc', a:method, a:args) : a:default
6767
endfunction
6868

69-
const s:root_dir = '<sfile>:h:h:h'->expand()
69+
const s:root_dir = '<script>:h:h:h'->expand()
7070
const s:sep = has('win32') ? '\' : '/'
7171
function ddc#denops#_mods() abort
7272
return [s:root_dir, 'denops', 'ddc', '_mods.js']->join(s:sep)

deno.jsonc

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
11
{
2-
"name": "@shougo/ddc-vim",
3-
"version": "0.0.0",
4-
"exports": {
5-
"./config": "./denops/ddc/base/config.ts",
6-
"./filter": "./denops/ddc/base/filter.ts",
7-
"./source": "./denops/ddc/base/source.ts",
8-
"./types": "./denops/ddc/types.ts",
9-
"./ui": "./denops/ddc/base/ui.ts",
10-
"./utils": "./denops/ddc/utils.ts"
11-
},
12-
"publish": {
13-
"include": [
14-
"denops/ddc/**/*.ts",
15-
"denops/ddc/**/*.js"
16-
]
17-
},
18-
"imports": {
19-
},
202
"lock": false,
213
"tasks": {
4+
"cache": "deno install --reload",
225
"check": "deno check denops/**/*.ts",
6+
"fmt": "deno fmt denops",
237
"lint": "deno lint denops",
248
"lint-fix": "deno lint --fix denops",
25-
"fmt": "deno fmt denops",
269
"test": "deno test -A --doc --parallel --shuffle denops/**/*.ts",
27-
"upgrade": "deno run -A jsr:@molt/cli **/*.ts --write"
28-
}
10+
"test:publish": "deno publish --dry-run --allow-dirty --set-version 0.0.0",
11+
"update": "deno outdated --recursive",
12+
"upgrade": "deno outdated --recursive --update"
13+
},
14+
"workspace": [
15+
"./denops/ddc"
16+
]
2917
}

denops/@ddu-sources/ddc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { Context, Item } from "jsr:@shougo/[email protected]/types";
2-
import { BaseSource } from "jsr:@shougo/[email protected]/source";
1+
import type { Context, Item } from "jsr:@shougo/ddu-vim@~10.3.0/types";
2+
import { BaseSource } from "jsr:@shougo/ddu-vim@~10.3.0/source";
33
import type { DdcItem } from "../ddc/types.ts";
44

55
import type { Denops } from "jsr:@denops/std@~7.6.0";

denops/ddc/app.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,19 @@ import type {
1414
UserOptions,
1515
} from "./types.ts";
1616
import { Loader } from "./loader.ts";
17-
import { isDenoCacheIssueError } from "./utils.ts";
17+
import { importPlugin, isDenoCacheIssueError } from "./utils.ts";
1818
import { createCallbackContext } from "./callback.ts";
1919
import { getFilter, getPreviewer, onCompleteDone, onEvent } from "./ext.ts";
2020
import type { BaseUi } from "./base/ui.ts";
2121
import type { BaseSource } from "./base/source.ts";
2222
import type { BaseFilter } from "./base/filter.ts";
2323

24-
import type { Denops, Entrypoint } from "jsr:@denops/std@~7.6.0";
25-
import * as vars from "jsr:@denops/std@~7.6.0/variable";
24+
import type { Denops, Entrypoint } from "@denops/std";
25+
import * as vars from "@denops/std/variable";
2626

27-
import { ensure } from "jsr:@core/unknownutil@~4.3.0/ensure";
28-
import { is } from "jsr:@core/unknownutil@~4.3.0/is";
29-
import { Lock } from "jsr:@core/asyncutil@~1.2.0/lock";
30-
import { toFileUrl } from "jsr:@std/path@~1.1.0/to-file-url";
27+
import { ensure } from "@core/unknownutil/ensure";
28+
import { is } from "@core/unknownutil/is";
29+
import { Lock } from "@core/asyncutil/lock";
3130

3231
export const main: Entrypoint = (denops: Denops) => {
3332
const loader = new Loader();
@@ -193,12 +192,9 @@ export const main: Entrypoint = (denops: Denops) => {
193192
await lock.lock(async () => {
194193
const path = ensure(arg1, is.String) as string;
195194
try {
196-
// NOTE: Import module with fragment so that reload works properly.
197-
// https://github.com/vim-denops/denops.vim/issues/227
198-
const mod = await import(
199-
`${toFileUrl(path).href}#${performance.now()}`
200-
);
201-
const obj = new mod.Config();
195+
const mod = await importPlugin(path);
196+
// deno-lint-ignore no-explicit-any
197+
const obj = new (mod as any).Config();
202198
await obj.config({ denops, contextBuilder, setAlias });
203199
} catch (e) {
204200
if (isDenoCacheIssueError(e)) {

denops/ddc/base/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ContextBuilder, DdcExtType } from "../types.ts";
22

3-
import type { Denops } from "jsr:@denops/std@~7.6.0";
3+
import type { Denops } from "@denops/std";
44

55
export type ConfigArguments = {
66
denops: Denops;

0 commit comments

Comments
 (0)