MCPcopy Create free account
hub / github.com/Borvik/vscode-postgres / setPort

Method setPort

src/commands/addConnection.ts:108–124  ·  view source on GitHub ↗
(input: MultiStepInput, state: Partial<ConnectionState>)

Source from the content-addressed store, hash-verified

106 }
107
108 async setPort(input: MultiStepInput, state: Partial<ConnectionState>) {
109 state.port = await input.showInputBox({
110 title: this.TITLE,
111 step: input.CurrentStepNumber,
112 totalSteps: this.TotalSteps,
113 prompt: 'The port number to connect to',
114 placeholder: 'ex. 5432',
115 ignoreFocusOut: true,
116 value: (typeof state.port === 'number') ? state.port.toString() : '',
117 validate: async (value) => {
118 if (!value || !value.trim()) return 'Port number is required';
119 return Number.isNaN(Number.parseInt(value)) ? 'The port number specified was not a number': '';
120 },
121 convert: async (value) => Number.parseInt(value)
122 });
123 return (input: MultiStepInput) => this.setSSL(input, state);
124 }
125
126 async setSSL(input: MultiStepInput, state: Partial<ConnectionState>) {
127 let active = sslOptions.find(s => s.ssl === !!state.secure);

Callers 1

setPasswordMethod · 0.95

Calls 2

setSSLMethod · 0.95
showInputBoxMethod · 0.80

Tested by

no test coverage detected