[web] Add autocomplete to LaTeX language for CodeMirror 6 (#5780)

GitOrigin-RevId: 90f1f3b680a68f8eb14828c9e5db94587974a6d4
This commit is contained in:
Alf Eaton 2021-11-16 10:27:24 +00:00 committed by Copybot
parent 8ca159b4b9
commit dd733fda84
5 changed files with 27 additions and 6 deletions

View file

@ -22,7 +22,10 @@ export default App.factory('metadata', function ($http, ide) {
metadata.onBroadcastDocMeta = function (data) {
if (data.docId != null && data.meta != null) {
return (state.documents[data.docId] = data.meta)
state.documents[data.docId] = data.meta
window.dispatchEvent(
new CustomEvent('project:metadata', { detail: state.documents })
)
}
}
@ -74,6 +77,9 @@ export default App.factory('metadata', function ($http, ide) {
const docMeta = data.projectMeta[docId]
result.push((state.documents[docId] = docMeta))
}
window.dispatchEvent(
new CustomEvent('project:metadata', { detail: state.documents })
)
return result
})()
}

View file

@ -61,7 +61,13 @@ export default ReferencesManager = class ReferencesManager {
_storeReferencesKeys(newKeys) {
// console.log '>> storing references keys'
const oldKeys = this.$scope.$root._references.keys
return (this.$scope.$root._references.keys = _.union(oldKeys, newKeys))
const keys = _.union(oldKeys, newKeys)
window.dispatchEvent(
new CustomEvent('project:references', {
detail: keys,
})
)
return (this.$scope.$root._references.keys = keys)
}
indexReferencesIfDocModified(doc, shouldBroadcast) {

View file

@ -4885,9 +4885,9 @@
}
},
"@codemirror/autocomplete": {
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-0.19.5.tgz",
"integrity": "sha512-4ZP9hUaGKw5iSeOMwBv3Qa5fZO8puuna7eDwB8jjRPOtxW4X6e2LY8SmsNSp3ZLXsrhUAOt8urNqv1jBp7SxqA==",
"version": "0.19.6",
"resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-0.19.6.tgz",
"integrity": "sha512-hFYpNWq/DHpZTDn51+40YfNXysfX/iUnUzYuXnDVLOYMyxCAC+0vzA6aMHACFp/R2CEpRFfdAsNrQZpFkWVgSg==",
"requires": {
"@codemirror/language": "^0.19.0",
"@codemirror/state": "^0.19.4",

View file

@ -47,7 +47,7 @@
"@babel/core": "^7.14.5",
"@babel/preset-env": "^7.14.5",
"@babel/preset-react": "^7.14.5",
"@codemirror/autocomplete": "^0.19.5",
"@codemirror/autocomplete": "^0.19.6",
"@codemirror/closebrackets": "^0.19.0",
"@codemirror/commands": "^0.19.5",
"@codemirror/comment": "^0.19.0",

View file

@ -77,12 +77,21 @@ export function EditorProviders({
openDoc: sinon.stub(),
}
const metadataManager = {
metadata: {
state: {
documents: {},
},
},
}
window._ide = {
$scope,
socket,
clsiServerId,
editorManager,
fileTreeManager,
metadataManager,
}
return (