getHints: function (implicitChar) {
            var deferred = $.Deferred(),
                data = Helpers.buildRequest(),
                cursor = getCursor(),
                token = getToken(cursor).string,
                cleanToken = tokenRegEx.test(token) ? token : '';
            
            data.wordToComplete = cleanToken;
            data.wantReturnType = true;
            data.wantSnippet = true;
            
            Omnisharp.makeRequest('autocomplete', data, function (err, res) {
                if (err !== null) {
                    deferred.reject(err);
                } else {

                    var completions = res.map(function (completion) {
                        return getCompletion(completion);
                    });

                    var results = {
                        hints: completions,
                        match: null,
                        selectInitial: true,
                        handleWideResults: true
                    };

                    deferred.resolve(results);
                }
            });
                
            return deferred;
        },
    function makeRequestAndRefreshDocument(service) {
        var document = DocumentManager.getCurrentDocument();
        var req = buildRequest();

        Omnisharp.makeRequest(service, req, function (err, res) {
            if (err !== null) {
                console.error(err);
            }

            document.setText(res.Buffer || res.Text);
        });
    }
Exemple #3
0
    function onClose(buttonId) {
        var renameTo = $input.val();

        if (buttonId === 'renameOk' && renameTo !== undefined) {
            var data = Helpers.buildRequest();
            data.renameto = renameTo;

            Omnisharp.makeRequest('rename', data, function (err, data) {
                data.Changes.forEach(function (change) {
                    var unixPath = FileUtils.convertWindowsPathToUnixPath(change.FileName);
                    DocumentManager.getDocumentForPath(unixPath).done(function (document) {
                        document.setText(change.Buffer);
                    });
                });
            });
        }
    }
    function validateFile(text, fullPath) {
        editor = EditorManager.getActiveEditor();
        codeMirror = editor._codeMirror;
        clearMarks();

        var deferred = $.Deferred();

        if (!isRunning) {
            deferred.resolve({ errors: [] });
            return deferred;
        }

        var data = Helpers.buildRequest();

        Omnisharp.makeRequest('codecheck', data, function (err, data) {
            if (err !== null) {
                deferred.reject();
                return deferred;
            }

            var result = {
                errors: []
            };

            if (data.Errors !== undefined) {
                result.errors = data.Errors.map(function (error) {
                    return processProblem(error);
                });
            }

            if (data.QuickFixes !== undefined) {
                result.errors = data.QuickFixes.map(function (quickFix) {
                    return processProblem(quickFix);
                });
            }

            deferred.resolve(result);
        });

        return deferred.promise();
    }