Don't ignore trim whitespace when diffing strings.
This commit is contained in:
@@ -7,7 +7,7 @@ import { getLoadedMonaco } from "@hediet/monaco-editor-react";
|
|||||||
|
|
||||||
export function getLanguageId(fileName: string): string {
|
export function getLanguageId(fileName: string): string {
|
||||||
const l = getLoadedMonaco().languages.getLanguages();
|
const l = getLoadedMonaco().languages.getLanguages();
|
||||||
const result = l.find(l => {
|
const result = l.find((l) => {
|
||||||
if (l.filenamePatterns) {
|
if (l.filenamePatterns) {
|
||||||
for (const p of l.filenamePatterns) {
|
for (const p of l.filenamePatterns) {
|
||||||
if (new RegExp(p).test(fileName)) {
|
if (new RegExp(p).test(fileName)) {
|
||||||
@@ -56,12 +56,10 @@ export class MonacoDiffEditor extends React.Component<{
|
|||||||
return getLanguageId(this.props.fileName);
|
return getLanguageId(this.props.fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private originalModel:
|
private originalModel: monacoTypes.editor.ITextModel | undefined =
|
||||||
| monacoTypes.editor.ITextModel
|
undefined;
|
||||||
| undefined = undefined;
|
private modifiedModel: monacoTypes.editor.ITextModel | undefined =
|
||||||
private modifiedModel:
|
undefined;
|
||||||
| monacoTypes.editor.ITextModel
|
|
||||||
| undefined = undefined;
|
|
||||||
|
|
||||||
@disposeOnUnmount
|
@disposeOnUnmount
|
||||||
private _updateText = autorun(() => {
|
private _updateText = autorun(() => {
|
||||||
@@ -106,6 +104,7 @@ export class MonacoDiffEditor extends React.Component<{
|
|||||||
readOnly: true,
|
readOnly: true,
|
||||||
theme: this.props.theme.kind === "dark" ? "vs-dark" : "vs",
|
theme: this.props.theme.kind === "dark" ? "vs-dark" : "vs",
|
||||||
renderWhitespace: "all",
|
renderWhitespace: "all",
|
||||||
|
ignoreTrimWhitespace: false,
|
||||||
});
|
});
|
||||||
if (this.originalModel && this.modifiedModel) {
|
if (this.originalModel && this.modifiedModel) {
|
||||||
this.editor.setModel({
|
this.editor.setModel({
|
||||||
|
|||||||
Reference in New Issue
Block a user