mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 11:38:51 +01:00
protocol: refactor to use enum for marshalled object ids
This commit is contained in:
@@ -23,6 +23,7 @@ import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneCont
|
||||
import { Codicon } from 'vs/base/common/codicons';
|
||||
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
|
||||
import { localize } from 'vs/nls';
|
||||
import { MarshalledId } from 'vs/base/common/marshalling';
|
||||
|
||||
|
||||
export class MainThreadCommentThread implements modes.CommentThread {
|
||||
@@ -154,7 +155,7 @@ export class MainThreadCommentThread implements modes.CommentThread {
|
||||
|
||||
toJSON(): any {
|
||||
return {
|
||||
$mid: 7,
|
||||
$mid: MarshalledId.CommentThread,
|
||||
commentControlHandle: this.controllerHandle,
|
||||
commentThreadHandle: this.commentThreadHandle,
|
||||
};
|
||||
@@ -347,7 +348,7 @@ export class MainThreadCommentController {
|
||||
|
||||
toJSON(): any {
|
||||
return {
|
||||
$mid: 6,
|
||||
$mid: MarshalledId.CommentController,
|
||||
handle: this.handle
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import { Command } from 'vs/editor/common/modes';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
|
||||
import { ISplice, Sequence } from 'vs/base/common/sequence';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { MarshalledId } from 'vs/base/common/marshalling';
|
||||
|
||||
class MainThreadSCMResourceGroup implements ISCMResourceGroup {
|
||||
|
||||
@@ -36,7 +37,7 @@ class MainThreadSCMResourceGroup implements ISCMResourceGroup {
|
||||
|
||||
toJSON(): any {
|
||||
return {
|
||||
$mid: 4,
|
||||
$mid: MarshalledId.ScmResourceGroup,
|
||||
sourceControlHandle: this.sourceControlHandle,
|
||||
groupHandle: this.handle
|
||||
};
|
||||
@@ -78,7 +79,7 @@ class MainThreadSCMResource implements ISCMResource {
|
||||
|
||||
toJSON(): any {
|
||||
return {
|
||||
$mid: 3,
|
||||
$mid: MarshalledId.ScmResource,
|
||||
sourceControlHandle: this.sourceControlHandle,
|
||||
groupHandle: this.groupHandle,
|
||||
handle: this.handle
|
||||
@@ -256,7 +257,7 @@ class MainThreadSCMProvider implements ISCMProvider {
|
||||
|
||||
toJSON(): any {
|
||||
return {
|
||||
$mid: 5,
|
||||
$mid: MarshalledId.ScmProvider,
|
||||
handle: this.handle
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { debounce } from 'vs/base/common/decorators';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { DisposableStore, IDisposable, MutableDisposable } from 'vs/base/common/lifecycle';
|
||||
import { MarshalledId } from 'vs/base/common/marshalling';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import * as modes from 'vs/editor/common/modes';
|
||||
@@ -41,7 +42,7 @@ export class ExtHostComments implements ExtHostCommentsShape, IDisposable {
|
||||
|
||||
commands.registerArgumentProcessor({
|
||||
processArgument: arg => {
|
||||
if (arg && arg.$mid === 6) {
|
||||
if (arg && arg.$mid === MarshalledId.CommentController) {
|
||||
const commentController = this._commentControllers.get(arg.handle);
|
||||
|
||||
if (!commentController) {
|
||||
@@ -49,7 +50,7 @@ export class ExtHostComments implements ExtHostCommentsShape, IDisposable {
|
||||
}
|
||||
|
||||
return commentController;
|
||||
} else if (arg && arg.$mid === 7) {
|
||||
} else if (arg && arg.$mid === MarshalledId.CommentThread) {
|
||||
const commentController = this._commentControllers.get(arg.commentControlHandle);
|
||||
|
||||
if (!commentController) {
|
||||
@@ -63,7 +64,7 @@ export class ExtHostComments implements ExtHostCommentsShape, IDisposable {
|
||||
}
|
||||
|
||||
return commentThread;
|
||||
} else if (arg && arg.$mid === 8) {
|
||||
} else if (arg && arg.$mid === MarshalledId.CommentThreadReply) {
|
||||
const commentController = this._commentControllers.get(arg.thread.commentControlHandle);
|
||||
|
||||
if (!commentController) {
|
||||
@@ -80,7 +81,7 @@ export class ExtHostComments implements ExtHostCommentsShape, IDisposable {
|
||||
thread: commentThread,
|
||||
text: arg.text
|
||||
};
|
||||
} else if (arg && arg.$mid === 9) {
|
||||
} else if (arg && arg.$mid === MarshalledId.CommentNode) {
|
||||
const commentController = this._commentControllers.get(arg.thread.commentControlHandle);
|
||||
|
||||
if (!commentController) {
|
||||
@@ -103,7 +104,7 @@ export class ExtHostComments implements ExtHostCommentsShape, IDisposable {
|
||||
|
||||
return comment;
|
||||
|
||||
} else if (arg && arg.$mid === 10) {
|
||||
} else if (arg && arg.$mid === MarshalledId.CommentThreadNode) {
|
||||
const commentController = this._commentControllers.get(arg.thread.commentControlHandle);
|
||||
|
||||
if (!commentController) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import { IRelativePattern } from 'vs/base/common/glob';
|
||||
import { hash } from 'vs/base/common/hash';
|
||||
import { DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ResourceMap } from 'vs/base/common/map';
|
||||
import { MarshalledId } from 'vs/base/common/marshalling';
|
||||
import { isFalsyOrWhitespace } from 'vs/base/common/strings';
|
||||
import { assertIsDefined } from 'vs/base/common/types';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
@@ -91,7 +92,7 @@ export class ExtHostNotebookController implements ExtHostNotebookShape {
|
||||
commands.registerArgumentProcessor({
|
||||
// Serialized INotebookCellActionContext
|
||||
processArgument: (arg) => {
|
||||
if (arg && arg.$mid === 12) {
|
||||
if (arg && arg.$mid === MarshalledId.NotebookCellActionContext) {
|
||||
const notebookUri = arg.notebookEditor?.notebookUri;
|
||||
const cellHandle = arg.cell.handle;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { checkProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { MarshalledId } from 'vs/base/common/marshalling';
|
||||
|
||||
type ProviderHandle = number;
|
||||
type GroupHandle = number;
|
||||
@@ -660,7 +661,7 @@ export class ExtHostSCM implements ExtHostSCMShape {
|
||||
|
||||
_commands.registerArgumentProcessor({
|
||||
processArgument: arg => {
|
||||
if (arg && arg.$mid === 3) {
|
||||
if (arg && arg.$mid === MarshalledId.ScmResource) {
|
||||
const sourceControl = this._sourceControls.get(arg.sourceControlHandle);
|
||||
|
||||
if (!sourceControl) {
|
||||
@@ -674,7 +675,7 @@ export class ExtHostSCM implements ExtHostSCMShape {
|
||||
}
|
||||
|
||||
return group.getResourceState(arg.handle);
|
||||
} else if (arg && arg.$mid === 4) {
|
||||
} else if (arg && arg.$mid === MarshalledId.ScmResourceGroup) {
|
||||
const sourceControl = this._sourceControls.get(arg.sourceControlHandle);
|
||||
|
||||
if (!sourceControl) {
|
||||
@@ -682,7 +683,7 @@ export class ExtHostSCM implements ExtHostSCMShape {
|
||||
}
|
||||
|
||||
return sourceControl.getResourceGroup(arg.groupHandle);
|
||||
} else if (arg && arg.$mid === 5) {
|
||||
} else if (arg && arg.$mid === MarshalledId.ScmProvider) {
|
||||
const sourceControl = this._sourceControls.get(arg.handle);
|
||||
|
||||
if (!sourceControl) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { CommandsConverter, ExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
|
||||
import { ThemeIcon } from 'vs/workbench/api/common/extHostTypes';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { MarshalledId } from 'vs/base/common/marshalling';
|
||||
|
||||
export interface IExtHostTimeline extends ExtHostTimelineShape {
|
||||
readonly _serviceBrand: undefined;
|
||||
@@ -38,7 +39,7 @@ export class ExtHostTimeline implements IExtHostTimeline {
|
||||
|
||||
commands.registerArgumentProcessor({
|
||||
processArgument: arg => {
|
||||
if (arg && arg.$mid === 11) {
|
||||
if (arg && arg.$mid === MarshalledId.TimelineActionContext) {
|
||||
const uri = arg.uri === undefined ? undefined : URI.revive(arg.uri);
|
||||
return this._itemsBySourceAndUriMap.get(arg.source)?.get(getUriKey(uri))?.get(arg.handle);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user