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

[plugin] Fixed wrong type conversion #6351

Merged
merged 1 commit into from
Oct 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/plugin-ext/src/common/rpc-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import { DisposableCollection, Disposable } from '@theia/core/lib/common/disposa
import { Deferred } from '@theia/core/lib/common/promise-util';
import VSCodeURI from 'vscode-uri';
import URI from '@theia/core/lib/common/uri';
import { CancellationToken, CancellationTokenSource, Range, Position } from 'vscode-languageserver-protocol';
import { CancellationToken, CancellationTokenSource } from 'vscode-languageserver-protocol';
import { Range, Position } from '../plugin/types-impl';

export interface MessageConnection {
send(msg: {}): void;
Expand Down Expand Up @@ -394,7 +395,7 @@ namespace ObjectsTransferrer {
$type: SerializedObjectType.THEIA_URI,
data: value.toString()
} as SerializedObject;
} else if (Range.is(value)) {
} else if (value instanceof Range) {
const range = value as Range;
const serializedValue = {
start: {
Expand Down Expand Up @@ -434,8 +435,9 @@ namespace ObjectsTransferrer {
case SerializedObjectType.THEIA_RANGE:
// tslint:disable-next-line:no-any
const obj: any = JSON.parse(value.data);
// May require to use types-impl there instead of vscode lang server Range for the revival
return Range.create(Position.create(obj.start.line, obj.start.character), Position.create(obj.end.line, obj.end.character));
const start = new Position(obj.start.line, obj.start.character);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️ this was already foreseen, kind of

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see one line above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, git it. I'll remove the comment

const end = new Position(obj.end.line, obj.end.character);
return new Range(start, end);
}
}

Expand Down