Skip to content

Commit

Permalink
Add full support for Diagnostic.committed
Browse files Browse the repository at this point in the history
Updated the framework to have full support according to the VS Code API:
  • Loading branch information
Estelle Foisy committed Sep 27, 2022
1 parent d1c886e commit 581da3a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
5 changes: 1 addition & 4 deletions packages/plugin-ext/src/common/plugin-api-rpc-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,7 @@ export interface CompletionResultDto extends IdObject {
}

export interface MarkerData {
code?: string | {
value: string;
target: theia.Uri;
};
code?: string;
severity: MarkerSeverity;
message: string;
source?: string;
Expand Down
18 changes: 11 additions & 7 deletions packages/plugin-ext/src/plugin/type-converters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,19 +439,23 @@ describe('Type converters:', () => {
});
});

describe('#convertCode', () => {
it('should return "true" if convertCode(string) is equal to string (string type)', () => {
describe.only('#convertCode', () => {
it('should return "true" if convertCode(string) is of string type (string)', () => {
expect(Converter.convertCode('string')).to.equal('string');
});
it('should return "true" if convertCode(4) is equal to 4 (string type)', () => {
it('should return "true" if convertCode(4) of string type (4)', () => {
expect(Converter.convertCode(4)).to.equal('4');
});
it('should return "true" if convertCode is equal to undefined (string type)', () => {
expect(Converter.convertCode(undefined)).to.equal('undefined');
it('should return "true" if convertCode is undefined', () => {
expect(Converter.convertCode(undefined)).to.equal(undefined);
});
it('should return "true" if convertCode is of type object', () => {
it('should return "true" if convertcode(object) is of string type (4)', () => {
const UriCode = types.URI.parse('foo://example.com:8042/over/there?name=ferret#nose');
expect(typeof Converter.convertCode({ value: 4, target: UriCode })).to.equal('object');
expect(Converter.convertCode({ value: 4, target: UriCode })).to.equal('4');
});
it('should return "true" if convertcode(object) is of string type (string)', () => {
const UriCode = types.URI.parse('foo://example.com:8042/over/there?name=ferret#nose');
expect(Converter.convertCode({ value: 'string', target: UriCode })).to.equal('string');
});
});
});
14 changes: 7 additions & 7 deletions packages/plugin-ext/src/plugin/type-converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,15 @@ export function convertDiagnosticToMarkerData(diagnostic: theia.Diagnostic): mod
};
}

export function convertCode(code: string | number | { value: string | number; target: theia.Uri } | undefined): string | { value: string; target: URI } {
export function convertCode(code: string | number | { value: string | number; target: theia.Uri } | undefined): string | undefined {

if (typeof code === 'string' || typeof code === 'number' || typeof code === 'undefined') {
return code = String(code);
if (typeof code === 'number') {
return String(code);
}
if (typeof code === 'string' || typeof code === 'undefined') {
return code;
} else {
return code = {
value: String(code.value),
target: code.target
};
return code = String(code.value);
};
}

Expand Down

0 comments on commit 581da3a

Please sign in to comment.