-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: upgrade codemirror 5 to codemirror 6 #1510
base: master
Are you sure you want to change the base?
Conversation
if (language && language in functionDocumentationByNameByLanguage) { | ||
const functionDefs = | ||
functionDocumentationByNameByLanguage[language]; | ||
const functionNameLower = (functionName || '').toLowerCase(); | ||
|
||
if (functionNameLower in functionDefs) { | ||
return functionDefs[functionNameLower]; | ||
} | ||
} | ||
|
||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (language && language in functionDocumentationByNameByLanguage) { | |
const functionDefs = | |
functionDocumentationByNameByLanguage[language]; | |
const functionNameLower = (functionName || '').toLowerCase(); | |
if (functionNameLower in functionDefs) { | |
return functionDefs[functionNameLower]; | |
} | |
} | |
return null; | |
const functionDefs = functionDocumentationByNameByLanguage?.[language]; | |
const functionNameLower = (functionName || '').toLowerCase(); | |
return functionDefs?.[functionNameLower]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also useCallback is not needed with above code
} | ||
|
||
if (lintSummary.numErrors + lintSummary.numWarnings > 0) { | ||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use span to be consistent
export const useAutoCompleteExtension = ({ view, autoCompleterRef }) => { | ||
const [typing, setTyping] = useState(false); | ||
|
||
const getCompletions = useCallback(async (context) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import {CompletionContext} from "@codemirror/autocomplete"?
if (tableInfo.line === line) { | ||
const isSchemaExplicit = | ||
tableInfo.end - tableInfo.start > | ||
tableInfo.name.length; | ||
const tablePos = { | ||
from: | ||
tableInfo.start + | ||
(isSchemaExplicit | ||
? tableInfo.schema.length | ||
: 0), | ||
to: tableInfo.end, | ||
}; | ||
|
||
if (tablePos.from <= ch && tablePos.to >= ch) { | ||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (tableInfo.line === line) { | |
const isSchemaExplicit = | |
tableInfo.end - tableInfo.start > | |
tableInfo.name.length; | |
const tablePos = { | |
from: | |
tableInfo.start + | |
(isSchemaExplicit | |
? tableInfo.schema.length | |
: 0), | |
to: tableInfo.end, | |
}; | |
if (tablePos.from <= ch && tablePos.to >= ch) { | |
return true; | |
} | |
if (tableInfo.line !== line) return false; | |
const isSchemaExplicit = | |
tableInfo.end - tableInfo.start > | |
tableInfo.name.length; | |
const tablePos = { | |
from: | |
tableInfo.start + | |
(isSchemaExplicit | |
? tableInfo.schema.length | |
: 0), | |
to: tableInfo.end, | |
}; | |
return tablePos.from <= ch && tablePos.to >= ch; |
} else { | ||
return null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!tooltipComponent) return null;
const lastPart = parts[parts.length - 1]; | ||
|
||
// Check if the last part is a single alphabetical character | ||
if (lastPart.length === 1 && /[a-zA-Z]/.test(lastPart)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this just test [A-Z]?
import { isEqual } from 'lodash'; | ||
import { useEffect, useRef } from 'react'; | ||
|
||
export default function useDeepCompareEffect(callback, dependencies) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add type to the parameters
Upgrade the query editor to use codemirror6, changes cover below editor features and most of them will have the same user experience
some screenshots
linter error and summary status bar
table hover
auto complete
search highlight