Skip to content

Commit

Permalink
refactor: remove extra props hover info logic due to upstream resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Dec 26, 2021
1 parent e339424 commit 8dd5b1c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 19 deletions.
18 changes: 1 addition & 17 deletions packages/vscode-vue-languageservice/src/services/hover.ts
Expand Up @@ -29,7 +29,7 @@ export function register({ sourceFiles, htmlLs, pugLs, getCssLs, getTsLs, vueHos
return result;
}

function onTs(uri: string, position: vscode.Position, isExtra = false) {
function onTs(uri: string, position: vscode.Position) {

let result: vscode.Hover | undefined;

Expand All @@ -48,25 +48,9 @@ export function register({ sourceFiles, htmlLs, pugLs, getCssLs, getTsLs, vueHos
const tsHover = tsLs.doHover(
tsLoc.uri,
tsLoc.range.start,
isExtra,
);
if (!tsHover) continue;

if (!isExtra && tsLoc.type === 'embedded-ts' && tsLoc.data.capabilities.extraHoverInfo) {
const definitions = findDefinitions.on(uri, position) as vscode.LocationLink[];
for (const definition of definitions) {
const extraHover = onTs(definition.targetUri, definition.targetSelectionRange.start, true);
if (!extraHover) continue;
if (!vscode.MarkupContent.is(extraHover.contents)) continue;
const extraText = extraHover.contents.value;
for (const extraTextPart of extraText.split('\n\n')) {
if (vscode.MarkupContent.is(tsHover.contents) && !tsHover.contents.value.split('\n\n').includes(extraTextPart)) {
tsHover.contents.value += `\n\n` + extraTextPart;
}
}
}
}

if (tsHover.range) {
// ts -> vue
const hoverRange = { start: position, end: position };
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-code-gen/src/generators/template.ts
Expand Up @@ -13,7 +13,7 @@ const capabilitiesSet = {
tagHover: { basic: true },
event: { basic: true, diagnostic: true },
tagReference: { references: true, definitions: true, rename: true, },
attr: { basic: true, extraHoverInfo: true, diagnostic: true, references: true, definitions: true, rename: true, },
attr: { basic: true, diagnostic: true, references: true, definitions: true, rename: true, },
attrReference: { references: true, definitions: true, rename: true, },
scopedClassName: { references: true, definitions: true, rename: true, },
slotName: { basic: true, diagnostic: true, references: true, definitions: true, completion: true, },
Expand Down
1 change: 0 additions & 1 deletion packages/vue-code-gen/src/types.ts
Expand Up @@ -5,7 +5,6 @@ export interface TsMappingData {
doRename?: (oldName: string, newName: string) => string,
capabilities: {
basic?: boolean,
extraHoverInfo?: boolean,
references?: boolean,
definitions?: boolean,
diagnostic?: boolean,
Expand Down

0 comments on commit 8dd5b1c

Please sign in to comment.