Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dependency module for install dependencies #4305

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
6 changes: 0 additions & 6 deletions data/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1421,12 +1421,6 @@
"scope": "application",
"description": "Winblend option of notification window, neovim only."
},
"npm.binPath": {
"type": "string",
"scope": "application",
"default": "npm",
"description": "Command or absolute path to npm or yarn."
},
"outline.autoPreview": {
"type": "boolean",
"scope": "application",
Expand Down
11 changes: 0 additions & 11 deletions doc/coc-config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Inlay hint |coc-config-inlayHint|
Links |coc-config-links|
List |coc-config-list|
Notification |coc-config-notification|
Npm |coc-config-npm|
Outline |coc-config-outline|
Pull diagnostics |coc-config-pullDiagnostic|
Refactor |coc-config-refactor|
Expand Down Expand Up @@ -790,16 +789,6 @@ Notification~

Scope: `application`, default: `30`

------------------------------------------------------------------------------
Npm~
*coc-config-npm*
"npm.binPath" *coc-config-npm-binPath*

Command or absolute path to npm or yarn for global extension
install/uninstall.

Scope: `application`, default: `"npm"`

------------------------------------------------------------------------------
Outline~
*coc-config-outline*
Expand Down
8 changes: 2 additions & 6 deletions doc/coc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,8 @@ Use |:CocInstall| to install coc extensions from vim's command line.

To make coc.nvim install extensions on startup, use |g:coc_global_extensions|.

To use package manager other than npm (like `yarn` or `pnpm`), use
|coc-config-npm-binPath|.

To customize npm registry for coc.nvim add `coc.nvim:registry` in your
`~/.npmrc`, like:
To customize node modules registry for coc.nvim add `coc.nvim:registry` in
your `~/.npmrc`, like:
>
coc.nvim:registry=https://registry.mycompany.org/
<
Expand Down Expand Up @@ -3642,7 +3639,6 @@ extensions *coc-list-extensions*
- 'enable' enable extension.
- 'lock' lock/unlock extension to current version.
- 'doc' view extension's README doc.
- 'fix' fix dependencies in terminal buffer.
- 'reload' reload extension.
- 'uninstall' uninstall extension.

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
"@types/jest": "^27.0.3",
"@types/marked": "^4.0.1",
"@types/minimatch": "^5.1.2",
"@types/mkdirp": "^1.0.1",
"@types/node": "14.14",
"@types/semver": "^7.3.4",
"@types/tar": "^4.0.5",
Expand Down
10 changes: 5 additions & 5 deletions src/__tests__/client/configuration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe('publish configuration feature', () => {
it('should send configuration for specific sections', async () => {
let client: LanguageClient
let called = false
client = createClient(['coc.preferences', 'npm', 'unknown'], {
client = createClient(['coc.preferences', 'http', 'unknown'], {
workspace: {
didChangeConfiguration: (sections, next) => {
called = true
Expand All @@ -139,12 +139,12 @@ describe('publish configuration feature', () => {
return changed != null
}, true)
expect(changed.settings.coc).toBeDefined()
expect(changed.settings.npm).toBeDefined()
expect(changed.settings.http).toBeDefined()
let { configurations } = workspace
configurations.updateMemoryConfig({ 'npm.binPath': 'cnpm' })
configurations.updateMemoryConfig({ 'http.proxyStrictSSL': false })
await helper.waitValue(() => {
return changed.settings.npm?.binPath
}, 'cnpm')
return changed.settings.http?.proxyStrictSSL
}, false)
await client.stop()
})

Expand Down
10 changes: 4 additions & 6 deletions src/__tests__/client/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,9 @@ describe('Client events', () => {
await client.sendNotification('showDocument', { uri: 'lsptest:///1', takeFocus: false })
await client.sendNotification('showDocument', { uri: uri.toString() })
await client.sendNotification('showDocument', { uri: uri.toString(), selection: Range.create(0, 0, 1, 0) })
await helper.wait(300)
expect(client.hasPendingResponse).toBe(false)
await helper.waitValue(() => {
return client.hasPendingResponse
}, false)
await client.stop()
})

Expand Down Expand Up @@ -628,7 +629,7 @@ describe('Client integration', () => {
}
await expect(fn()).rejects.toThrow(Error)
spy.mockRestore()
await helper.wait(10)
await helper.wait(30)
})
})

Expand All @@ -649,9 +650,6 @@ describe('SettingMonitor', () => {
return client.state
}, lsclient.State.Stopped)
helper.updateConfiguration('html.enabled', true)
await helper.waitValue(() => {
return client.state != lsclient.State.Stopped
}, true)
await client.onReady()
disposable.dispose()
})
Expand Down
21 changes: 21 additions & 0 deletions src/__tests__/helper.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import net from 'net'
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-call */
import { Buffer, Neovim, Window } from '@chemzqm/neovim'
Expand Down Expand Up @@ -364,4 +365,24 @@ export function makeLine(length) {
return result
}

export function getPort(): Promise<number> {
let port = 7080
let fn = cb => {
let server = net.createServer()
server.listen(port, () => {
server.once('close', () => {
cb(port)
})
server.close()
})
server.on('error', () => {
port++
fn(cb)
})
}
return new Promise(resolve => {
fn(resolve)
})
}

export default new Helper()