Created
November 1, 2014 15:53
-
-
Save mat-mcloughlin/c2dc3fb178c046a9fb0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */ | |
/*global define, $, brackets, window */ | |
define(function (require, exports, module) { | |
'use strict'; | |
var CodeHintManager = brackets.getModule('editor/CodeHintManager'), | |
EditorManager = brackets.getModule("editor/EditorManager"), | |
Helpers = require('modules/helpers'), | |
Omnisharp = require('modules/omnisharp'); | |
var intellisense = { | |
hasHints: function (editor, implicitChar) { | |
if (implicitChar === ' ' || implicitChar === '.') { | |
return true; | |
} | |
return false; | |
}, | |
getHints: function (implicitChar) { | |
var deferred = $.Deferred(); | |
var data = Helpers.buildRequest(); | |
data.wordToComplete = ''; | |
Omnisharp.makeRequest('autocomplete', data, function (err, data) { | |
if (err !== null) { | |
deferred.reject(); | |
} | |
var completions = data.map(function (completion) { | |
return completion.CompletionText; | |
}); | |
var something = { | |
hints: completions, | |
match: null, | |
selectInitial: true, | |
handleWideResults: true | |
}; | |
deferred.resolve(something); | |
}); | |
return deferred.promise(); | |
}, | |
insertHint: function (hint) { | |
} | |
}; | |
return { | |
init: function () { | |
CodeHintManager.registerHintProvider(intellisense, ['csharp'], 0); | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment