Skip to content

Commit

Permalink
Strict null check VS Code
Browse files Browse the repository at this point in the history
Fixes #60565
Fixes #70417
  • Loading branch information
mjbvz committed Mar 19, 2019
1 parent c51f04c commit 7d0e64f
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 444 deletions.
19 changes: 1 addition & 18 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,6 @@
}
}
},
{
"type": "npm",
"script": "strict-null-check-watch",
"label": "TS - Strict Null Checks",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"problemMatcher": {
"base": "$tsc-watch",
"owner": "typescript-strict-null",
"applyTo": "allDocuments"
},
"runOptions": {
"runOn": "folderOpen"
}
},
{
"type": "gulp",
"task": "tslint",
Expand Down Expand Up @@ -86,4 +69,4 @@
"problemMatcher": []
}
]
}
}
3 changes: 0 additions & 3 deletions build/azure-pipelines/darwin/continuous-build-darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ steps:
- script: |
yarn monaco-compile-check
displayName: Run Monaco Editor Checks
- script: |
yarn strict-null-check
displayName: Run Strict Null Checks
- script: |
yarn compile
displayName: Compile Sources
Expand Down
1 change: 0 additions & 1 deletion build/azure-pipelines/darwin/product-build-darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ steps:
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" yarn gulp -- mixin
yarn gulp -- hygiene
yarn monaco-compile-check
yarn strict-null-check
node build/azure-pipelines/common/installDistro.js
node build/lib/builtInExtensions.js
displayName: Prepare build
Expand Down
3 changes: 0 additions & 3 deletions build/azure-pipelines/linux/continuous-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ steps:
- script: |
yarn monaco-compile-check
displayName: Run Monaco Editor Checks
- script: |
yarn strict-null-check
displayName: Run Strict Null Checks
- script: |
yarn compile
displayName: Compile Sources
Expand Down
1 change: 0 additions & 1 deletion build/azure-pipelines/linux/product-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ steps:
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" npm run gulp -- mixin
npm run gulp -- hygiene
npm run monaco-compile-check
npm run strict-null-check
node build/azure-pipelines/common/installDistro.js
node build/lib/builtInExtensions.js
Expand Down
3 changes: 0 additions & 3 deletions build/azure-pipelines/win32/continuous-build-win32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ steps:
- powershell: |
yarn monaco-compile-check
displayName: Run Monaco Editor Checks
- script: |
yarn strict-null-check
displayName: Run Strict Null Checks
- powershell: |
yarn compile
displayName: Compile Sources
Expand Down
1 change: 0 additions & 1 deletion build/azure-pipelines/win32/product-build-win32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ steps:
exec { npm run gulp -- mixin }
exec { npm run gulp -- hygiene }
exec { npm run monaco-compile-check }
exec { npm run strict-null-check }
exec { node build/azure-pipelines/common/installDistro.js }
exec { node build/lib/builtInExtensions.js }
Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@
"update-grammars": "node build/npm/update-all-grammars.js",
"update-localization-extension": "node build/npm/update-localization-extension.js",
"smoketest": "cd test/smoke && node test/index.js",
"monaco-compile-check": "tsc -p src/tsconfig.monaco.json --noEmit",
"download-builtin-extensions": "node build/lib/builtInExtensions.js",
"strict-null-check": "tsc -p src/tsconfig.strictNullChecks.json",
"strict-null-check-watch": "tsc -p src/tsconfig.strictNullChecks.json --watch"
"monaco-compile-check": "tsc -p src/tsconfig.monaco.json --noEmit"
},
"dependencies": {
"applicationinsights": "1.0.8",
Expand Down
1 change: 1 addition & 0 deletions src/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"noImplicitThis": true,
"alwaysStrict": true,
"strictBindCallApply": true,
"strictNullChecks": true,
"baseUrl": ".",
"paths": {
"vs/*": [
Expand Down
2 changes: 1 addition & 1 deletion src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
"exclude": [
"./typings/require-monaco.d.ts"
]
}
}
400 changes: 0 additions & 400 deletions src/tsconfig.strictNullChecks.json

This file was deleted.

3 changes: 2 additions & 1 deletion src/vs/workbench/api/node/extHostExtensionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import * as vscode from 'vscode';
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { IWorkspace } from 'vs/platform/workspace/common/workspace';
import { Schemas } from 'vs/base/common/network';
import { withNullAsUndefined } from 'vs/base/common/types';

class ExtensionMemento implements IExtensionMemento {

Expand Down Expand Up @@ -201,7 +202,7 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
this._readyToRunExtensions = new Barrier();
this._registry = new ExtensionDescriptionRegistry(initData.extensions);
this._storage = new ExtHostStorage(this._extHostContext);
this._storagePath = new ExtensionStoragePath(initData.workspace, initData.environment);
this._storagePath = new ExtensionStoragePath(withNullAsUndefined(initData.workspace), initData.environment);

const hostExtensions = new Set<string>();
initData.hostExtensions.forEach((extensionId) => hostExtensions.add(ExtensionIdentifier.toKey(extensionId)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { ExtHostLogService } from 'vs/workbench/api/node/extHostLogService';
import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
import { RPCProtocol } from 'vs/workbench/services/extensions/node/rpcProtocol';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { withNullAsUndefined } from 'vs/base/common/types';

// we don't (yet) throw when extensions parse
// uris that have no scheme
Expand Down Expand Up @@ -73,7 +74,7 @@ export class ExtensionHostMain {
this.disposables.push(this._extHostLogService);

this._searchRequestIdProvider = new Counter();
const extHostWorkspace = new ExtHostWorkspace(rpcProtocol, this._extHostLogService, this._searchRequestIdProvider, initData.workspace);
const extHostWorkspace = new ExtHostWorkspace(rpcProtocol, this._extHostLogService, this._searchRequestIdProvider, withNullAsUndefined(initData.workspace));

this._extHostLogService.info('extension host started');
this._extHostLogService.trace('initData', initData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ function _createExtHostProtocol(): Promise<IMessagePassingProtocol> {

// Now that we have managed to install a message listener, ask the other side to send us the socket
const req: IExtHostReadyMessage = { type: 'VSCODE_EXTHOST_IPC_READY' };
process.send(req);
if (process.send) {
process.send(req);
}
});

} else {
Expand Down
14 changes: 8 additions & 6 deletions src/vs/workbench/services/extensions/node/proxyResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function setupProxyResolution(
return;
}

if (envNoProxy(hostname, String(parsedUrl.port || (<any>opts.agent).defaultPort))) {
if (typeof hostname === 'string' && envNoProxy(hostname, String(parsedUrl.port || (<any>opts.agent).defaultPort))) {
envNoProxyCount++;
callback('DIRECT');
extHostLogService.trace('ProxyResolver#resolveProxy envNoProxy', url, 'DIRECT');
Expand Down Expand Up @@ -184,8 +184,10 @@ function setupProxyResolution(
const start = Date.now();
extHostWorkspace.resolveProxy(url) // Use full URL to ensure it is an actually used one.
.then(proxy => {
cacheProxy(key, proxy);
collectResult(results, proxy, parsedUrl.protocol === 'https:' ? 'HTTPS' : 'HTTP', req);
if (proxy) {
cacheProxy(key, proxy);
collectResult(results, proxy, parsedUrl.protocol === 'https:' ? 'HTTPS' : 'HTTP', req);
}
callback(proxy);
extHostLogService.debug('ProxyResolver#resolveProxy', url, proxy);
}).then(() => {
Expand Down Expand Up @@ -314,7 +316,7 @@ function patches(originals: typeof http | typeof https, resolveProxy: ReturnType
};

function patch(original: typeof http.get) {
function patched(url: string | URL, options?: http.RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest {
function patched(url?: string | URL | null, options?: http.RequestOptions | null, callback?: (res: http.IncomingMessage) => void): http.ClientRequest {
if (typeof url !== 'string' && !(url && (<any>url).searchParams)) {
callback = <any>options;
options = url;
Expand Down Expand Up @@ -457,10 +459,10 @@ async function readCaCertificates() {
function readWindowsCaCertificates() {
const winCA = require.__$__nodeRequire<any>('win-ca-lib');

let ders = [];
let ders: any[] = [];
const store = winCA();
try {
let der;
let der: any;
while (der = store.next()) {
ders.push(der);
}
Expand Down

0 comments on commit 7d0e64f

Please sign in to comment.