|
@@ -25,6 +25,12 @@ import sqlStatementsParser from 'parse/sqlStatementsParser';
|
|
|
import sqlUtils from 'sql/sqlUtils';
|
|
import sqlUtils from 'sql/sqlUtils';
|
|
|
import stringDistance from 'sql/stringDistance';
|
|
import stringDistance from 'sql/stringDistance';
|
|
|
import { DIALECT } from 'apps/notebook2/snippet';
|
|
import { DIALECT } from 'apps/notebook2/snippet';
|
|
|
|
|
+import {
|
|
|
|
|
+ POST_FROM_LOCATION_WORKER_EVENT,
|
|
|
|
|
+ POST_FROM_SYNTAX_WORKER_EVENT,
|
|
|
|
|
+ POST_TO_LOCATION_WORKER_EVENT,
|
|
|
|
|
+ POST_TO_SYNTAX_WORKER_EVENT
|
|
|
|
|
+} from 'sql/sqlWorkerHandler';
|
|
|
|
|
|
|
|
// TODO: depends on Ace, sqlStatementsParser
|
|
// TODO: depends on Ace, sqlStatementsParser
|
|
|
|
|
|
|
@@ -719,13 +725,13 @@ class AceLocationHandler {
|
|
|
statementLocation.last_column
|
|
statementLocation.last_column
|
|
|
)
|
|
)
|
|
|
);
|
|
);
|
|
|
- huePubSub.publish('ace.sql.syntax.worker.post', {
|
|
|
|
|
|
|
+ huePubSub.publish(POST_TO_SYNTAX_WORKER_EVENT, {
|
|
|
id: self.snippet.id(),
|
|
id: self.snippet.id(),
|
|
|
editorChangeTime: editorChangeTime,
|
|
editorChangeTime: editorChangeTime,
|
|
|
beforeCursor: beforeCursor,
|
|
beforeCursor: beforeCursor,
|
|
|
afterCursor: afterCursor,
|
|
afterCursor: afterCursor,
|
|
|
statementLocation: statementLocation,
|
|
statementLocation: statementLocation,
|
|
|
- type: self.dialect()
|
|
|
|
|
|
|
+ connector: self.snippet.connector()
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -753,7 +759,7 @@ class AceLocationHandler {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- self.sqlSyntaxWorkerSub = huePubSub.subscribe('ace.sql.syntax.worker.message', e => {
|
|
|
|
|
|
|
+ self.sqlSyntaxWorkerSub = huePubSub.subscribe(POST_FROM_SYNTAX_WORKER_EVENT, e => {
|
|
|
if (
|
|
if (
|
|
|
e.data.id !== self.snippet.id() ||
|
|
e.data.id !== self.snippet.id() ||
|
|
|
e.data.editorChangeTime !== self.editor.lastChangeTime
|
|
e.data.editorChangeTime !== self.editor.lastChangeTime
|
|
@@ -1191,7 +1197,7 @@ class AceLocationHandler {
|
|
|
getLocationsSub.remove();
|
|
getLocationsSub.remove();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- const locationWorkerSub = huePubSub.subscribe('ace.sql.location.worker.message', e => {
|
|
|
|
|
|
|
+ const locationWorkerSub = huePubSub.subscribe(POST_FROM_LOCATION_WORKER_EVENT, e => {
|
|
|
if (
|
|
if (
|
|
|
e.data.id !== self.snippet.id() ||
|
|
e.data.id !== self.snippet.id() ||
|
|
|
e.data.editorChangeTime !== self.editor.lastChangeTime ||
|
|
e.data.editorChangeTime !== self.editor.lastChangeTime ||
|
|
@@ -1202,7 +1208,7 @@ class AceLocationHandler {
|
|
|
|
|
|
|
|
lastKnownLocations = {
|
|
lastKnownLocations = {
|
|
|
id: self.editorId,
|
|
id: self.editorId,
|
|
|
- type: self.dialect(),
|
|
|
|
|
|
|
+ connector: self.snippet.connector(),
|
|
|
namespace: self.snippet.namespace(),
|
|
namespace: self.snippet.namespace(),
|
|
|
compute: self.snippet.compute(),
|
|
compute: self.snippet.compute(),
|
|
|
defaultDatabase: self.snippet.database(),
|
|
defaultDatabase: self.snippet.database(),
|
|
@@ -1337,10 +1343,10 @@ class AceLocationHandler {
|
|
|
lastContextRequest.dispose();
|
|
lastContextRequest.dispose();
|
|
|
}
|
|
}
|
|
|
lastContextRequest = self.snippet.whenContextSet().done(() => {
|
|
lastContextRequest = self.snippet.whenContextSet().done(() => {
|
|
|
- huePubSub.publish('ace.sql.location.worker.post', {
|
|
|
|
|
|
|
+ huePubSub.publish(POST_TO_LOCATION_WORKER_EVENT, {
|
|
|
id: self.snippet.id(),
|
|
id: self.snippet.id(),
|
|
|
statementDetails: statementDetails,
|
|
statementDetails: statementDetails,
|
|
|
- type: self.snippet && self.snippet.dialect ? self.snippet.dialect() : self.dialect(),
|
|
|
|
|
|
|
+ connector: self.snippet.connector(),
|
|
|
namespace: self.snippet.namespace(),
|
|
namespace: self.snippet.namespace(),
|
|
|
compute: self.snippet.compute(),
|
|
compute: self.snippet.compute(),
|
|
|
defaultDatabase: self.snippet.database()
|
|
defaultDatabase: self.snippet.database()
|