Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

Commit

Permalink
fix #13
Browse files Browse the repository at this point in the history
  • Loading branch information
richard1122 committed Nov 8, 2016
1 parent 191d6f0 commit e5af87e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
6 changes: 3 additions & 3 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@
"default": false,
"description": "show debug messages"
},
"ycmd.enable_hover_type": {
"ycmd.use_imprecise_get_type": {
"type": "boolean",
"default": true,
"description": "GetType from ycmd by hover on variable"
"default": false,
"description": "use GetTypeImprecise subcommand instand of GetType, please see https://github.com/Valloric/ycmd/pull/609"
}
}
},
Expand Down
3 changes: 3 additions & 0 deletions server/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "./node_modules/typescript/lib"
}
2 changes: 1 addition & 1 deletion server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ connection.onNotification<YcmFixIt>({ method: 'FixIt'}, async (args) => {
connection.onHover(async (event): Promise<Hover> => {
const ycm = await getYcm()
try {
return await ycm.getType(event.textDocument.uri, event.position, documents)
return await ycm.getType(event.textDocument.uri, event.position, documents, workspaceConfiguration.ycmd.use_imprecise_get_type)
} catch (err) {
logger(`onHover error`, err)
}
Expand Down
14 changes: 7 additions & 7 deletions server/src/ycm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,8 @@ export default class Ycm {
return res
}

public async getType(documentUri: string, position: Position, documents: TextDocuments) {
if (!this.settings.ycmd.enable_hover_type) return null
const type = await this.runCompleterCommand(documentUri, position, documents, 'GetType') as YcmGetTypeResponse
public async getType(documentUri: string, position: Position, documents: TextDocuments, imprecise: boolean = false) {
const type = await this.runCompleterCommand(documentUri, position, documents, imprecise ? 'GetTypeImprecise' : 'GetType') as YcmGetTypeResponse
logger('getType', JSON.stringify(type))
return mapYcmTypeToHover(type, documents.get(documentUri).languageId)
}
Expand Down Expand Up @@ -298,10 +297,11 @@ export default class Ycm {
export interface Settings {
ycmd: {
path: string
global_extra_config: string,
python: string,
confirm_extra_conf: boolean,
debug: boolean,
global_extra_config: string
python: string
confirm_extra_conf: boolean
debug: boolean
enable_hover_type: boolean
use_imprecise_get_type: boolean
}
}

0 comments on commit e5af87e

Please # to comment.