Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Language Server Protocol Support for Brackets - Fix Author #14678

Merged
merged 1 commit into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,15 @@ module.exports = {
"Uint32Array": false,
"WebSocket": false,
"XMLHttpRequest": false
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "script",
"ecmaFeatures": {
"arrowFunctions": true,
"binaryLiterals": true,
"blockBindings": true,
"classes": true
}
}
};
3 changes: 3 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ module.exports = function (grunt) {
src: [
'extensibility/node/**',
'JSUtils/node/**',
'languageTools/node/**',
'languageTools/styles/**',
'languageTools/LanguageClient/**',
'!extensibility/node/spec/**',
'!extensibility/node/node_modules/**/{test,tst}/**/*',
'!extensibility/node/node_modules/**/examples/**/*',
Expand Down
13 changes: 13 additions & 0 deletions src/brackets.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ define(function (require, exports, module) {
return PathUtils;
}
});

//load language features
require("features/ParameterHintsManager");
require("features/JumpToDefManager");

// Load modules that self-register and just need to get included in the main project
require("command/DefaultMenus");
Expand All @@ -155,6 +159,15 @@ define(function (require, exports, module) {
require("JSUtils/Session");
require("JSUtils/ScopeManager");

//load Language Tools Module
require("languageTools/PathConverters");
require("languageTools/LanguageTools");
require("languageTools/ClientLoader");
require("languageTools/BracketsToNodeInterface");
require("languageTools/DefaultProviders");
require("languageTools/DefaultEventHandlers");


PerfUtils.addMeasurement("brackets module dependencies resolved");

// Local variables
Expand Down
2 changes: 1 addition & 1 deletion src/command/Commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ define(function (require, exports, module) {
exports.NAVIGATE_SHOW_IN_FILE_TREE = "navigate.showInFileTree"; // DocumentCommandHandlers.js handleShowInTree()
exports.NAVIGATE_SHOW_IN_OS = "navigate.showInOS"; // DocumentCommandHandlers.js handleShowInOS()
exports.NAVIGATE_QUICK_OPEN = "navigate.quickOpen"; // QuickOpen.js doFileSearch()
exports.NAVIGATE_JUMPTO_DEFINITION = "navigate.jumptoDefinition"; // EditorManager.js _doJumpToDef()
exports.NAVIGATE_JUMPTO_DEFINITION = "navigate.jumptoDefinition"; // JumpToDefManager.js _doJumpToDef()
exports.NAVIGATE_GOTO_DEFINITION = "navigate.gotoDefinition"; // QuickOpen.js doDefinitionSearch()
exports.NAVIGATE_GOTO_LINE = "navigate.gotoLine"; // QuickOpen.js doGotoLine()
exports.NAVIGATE_GOTO_FIRST_PROBLEM = "navigate.gotoFirstProblem"; // CodeInspection.js handleGotoFirstProblem()
Expand Down
76 changes: 0 additions & 76 deletions src/editor/EditorManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,6 @@ define(function (require, exports, module) {
*/
var _inlineDocsProviders = [];

/**
* Registered jump-to-definition providers.
* @see {@link #registerJumpToDefProvider}.
* @private
* @type {Array.<function(...)>}
*/
var _jumpToDefProviders = [];


/**
* DOM element to house any hidden editors created soley for inline widgets
* @private
Expand Down Expand Up @@ -423,19 +414,6 @@ define(function (require, exports, module) {
_insertProviderSorted(_inlineDocsProviders, provider, priority);
}

/**
* Registers a new jump-to-definition provider. When jump-to-definition is invoked each
* registered provider is asked if it wants to provide jump-to-definition results, given
* the current editor and cursor location.
*
* @param {function(!Editor, !{line:number, ch:number}):?$.Promise} provider
* The provider returns a promise that is resolved whenever it's done handling the operation,
* or returns null to indicate the provider doesn't want to respond to this case. It is entirely
* up to the provider to open the file containing the definition, select the appropriate text, etc.
*/
function registerJumpToDefProvider(provider) {
_jumpToDefProviders.push(provider);
}

/**
* @private
Expand Down Expand Up @@ -705,55 +683,6 @@ define(function (require, exports, module) {
return _lastFocusedEditor;
}


/**
* Asynchronously asks providers to handle jump-to-definition.
* @return {!Promise} Resolved when the provider signals that it's done; rejected if no
* provider responded or the provider that responded failed.
*/
function _doJumpToDef() {
var providers = _jumpToDefProviders;
var promise,
i,
result = new $.Deferred();

var editor = getActiveEditor();

if (editor) {
var pos = editor.getCursorPos();

PerfUtils.markStart(PerfUtils.JUMP_TO_DEFINITION);

// Run through providers until one responds
for (i = 0; i < providers.length && !promise; i++) {
var provider = providers[i];
promise = provider(editor, pos);
}

// Will one of them will provide a result?
if (promise) {
promise.done(function () {
PerfUtils.addMeasurement(PerfUtils.JUMP_TO_DEFINITION);
result.resolve();
}).fail(function () {
// terminate timer that was started above
PerfUtils.finalizeMeasurement(PerfUtils.JUMP_TO_DEFINITION);
result.reject();
});
} else {
// terminate timer that was started above
PerfUtils.finalizeMeasurement(PerfUtils.JUMP_TO_DEFINITION);
result.reject();
}

} else {
result.reject();
}

return result.promise();
}


/**
* file removed from pane handler.
* @param {jQuery.Event} e
Expand Down Expand Up @@ -797,10 +726,6 @@ define(function (require, exports, module) {
CommandManager.register(Strings.CMD_TOGGLE_QUICK_DOCS, Commands.TOGGLE_QUICK_DOCS, function () {
return _toggleInlineWidget(_inlineDocsProviders, Strings.ERROR_QUICK_DOCS_PROVIDER_NOT_FOUND);
});
CommandManager.register(Strings.CMD_JUMPTO_DEFINITION, Commands.NAVIGATE_JUMPTO_DEFINITION, _doJumpToDef);

// Create PerfUtils measurement
PerfUtils.createPerfMeasurement("JUMP_TO_DEFINITION", "Jump-To-Definiiton");

MainViewManager.on("currentFileChange", _handleCurrentFileChange);
MainViewManager.on("workingSetRemove workingSetRemoveList", _handleRemoveFromPaneView);
Expand Down Expand Up @@ -830,7 +755,6 @@ define(function (require, exports, module) {

exports.registerInlineEditProvider = registerInlineEditProvider;
exports.registerInlineDocsProvider = registerInlineDocsProvider;
exports.registerJumpToDefProvider = registerJumpToDefProvider;

// Deprecated
exports.registerCustomViewer = registerCustomViewer;
Expand Down
Loading