Skip to content
Permalink
Browse files

Strict null check VS Code

Fixes #60565
Fixes #70417
  • Loading branch information...
mjbvz committed Mar 19, 2019
1 parent c51f04c commit 7d0e64f5ec69c1452bcf227692768db45b8d6334
@@ -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",
@@ -86,4 +69,4 @@
"problemMatcher": []
}
]
}
}
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 }
@@ -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",
@@ -10,6 +10,7 @@
"noImplicitThis": true,
"alwaysStrict": true,
"strictBindCallApply": true,
"strictNullChecks": true,
"baseUrl": ".",
"paths": {
"vs/*": [
@@ -19,4 +19,4 @@
"exclude": [
"./typings/require-monaco.d.ts"
]
}
}

This file was deleted.

@@ -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 {

@@ -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)));
@@ -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
@@ -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);
@@ -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 {
@@ -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');
@@ -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(() => {
@@ -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;
@@ -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);
}

0 comments on commit 7d0e64f

Please sign in to comment.
You can’t perform that action at this time.