Fixed tslint errors
This commit is contained in:
		
							parent
							
								
									51b6b4fbaa
								
							
						
					
					
						commit
						d753e957a0
					
				
					 2 changed files with 18 additions and 18 deletions
				
			
		| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
import { workspace } from "vscode";
 | 
			
		||||
import { ProviderResult, Range, TextEdit, editor, editorEdit, Selection } from "vscode";
 | 
			
		||||
import { ProviderResult, Range, TextEdit, TextEditor, Selection } from "vscode";
 | 
			
		||||
 | 
			
		||||
import { NativeCommands } from "../../common";
 | 
			
		||||
import * as constants from "../../constants";
 | 
			
		||||
| 
						 | 
				
			
			@ -8,19 +8,19 @@ import { XmlFormatterFactory } from "../xml-formatter";
 | 
			
		|||
import { XmlFormattingEditProvider } from "../xml-formatting-edit-provider";
 | 
			
		||||
import { XmlFormattingOptionsFactory } from "../xml-formatting-options";
 | 
			
		||||
 | 
			
		||||
export function textToXml(editor: editor, edit: editorEdit): void {
 | 
			
		||||
    editor.edit(edit => {
 | 
			
		||||
        let selections = editor.selections;
 | 
			
		||||
export function textToXml(textEditor: TextEditor): void {
 | 
			
		||||
    textEditor.edit(textEdit => {
 | 
			
		||||
        const selections = textEditor.selections;
 | 
			
		||||
        selections.forEach(selection => {
 | 
			
		||||
            if (selection.isEmpty) {
 | 
			
		||||
                selection = new Selection(
 | 
			
		||||
                    editor.document.positionAt(0),
 | 
			
		||||
                    editor.document.positionAt(editor.document.getText().length)
 | 
			
		||||
                    textEditor.document.positionAt(0),
 | 
			
		||||
                    textEditor.document.positionAt(textEditor.document.getText().length)
 | 
			
		||||
                );
 | 
			
		||||
            }
 | 
			
		||||
            let txt = editor.document.getText(new Range(selection.start, selection.end));
 | 
			
		||||
            let transformed = txt.replace(/</g, '<').replace(/>/g, '>');
 | 
			
		||||
            edit.replace(selection, transformed);
 | 
			
		||||
            const txt = textEditor.document.getText(new Range(selection.start, selection.end));
 | 
			
		||||
            const transformed = txt.replace(/</g, "<").replace(/>/g, ">");
 | 
			
		||||
            textEdit.replace(selection, transformed);
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
import { workspace } from "vscode";
 | 
			
		||||
import { ProviderResult, Range, TextEdit, editor, editorEdit, Selection } from "vscode";
 | 
			
		||||
import { ProviderResult, Range, TextEdit, TextEditor, Selection } from "vscode";
 | 
			
		||||
 | 
			
		||||
import { NativeCommands } from "../../common";
 | 
			
		||||
import * as constants from "../../constants";
 | 
			
		||||
| 
						 | 
				
			
			@ -8,19 +8,19 @@ import { XmlFormatterFactory } from "../xml-formatter";
 | 
			
		|||
import { XmlFormattingEditProvider } from "../xml-formatting-edit-provider";
 | 
			
		||||
import { XmlFormattingOptionsFactory } from "../xml-formatting-options";
 | 
			
		||||
 | 
			
		||||
export function xmlToText(editor: editor, edit: editorEdit): void {
 | 
			
		||||
    editor.edit(edit => {
 | 
			
		||||
        let selections = editor.selections;
 | 
			
		||||
export function xmlToText(textEditor: TextEditor): void {
 | 
			
		||||
    textEditor.edit(textEdit => {
 | 
			
		||||
        const selections = textEditor.selections;
 | 
			
		||||
        selections.forEach(selection => {
 | 
			
		||||
            if (selection.isEmpty) {
 | 
			
		||||
                selection = new Selection(
 | 
			
		||||
                    editor.document.positionAt(0),
 | 
			
		||||
                    editor.document.positionAt(editor.document.getText().length)
 | 
			
		||||
                    textEditor.document.positionAt(0),
 | 
			
		||||
                    textEditor.document.positionAt(textEditor.document.getText().length)
 | 
			
		||||
                );
 | 
			
		||||
            }
 | 
			
		||||
            let txt = editor.document.getText(new Range(selection.start, selection.end));
 | 
			
		||||
            let transformed = txt.replace(/</g, '<').replace(/>/g, '>');
 | 
			
		||||
            edit.replace(selection, transformed);
 | 
			
		||||
            const txt = textEditor.document.getText(new Range(selection.start, selection.end));
 | 
			
		||||
            const transformed = txt.replace(/</g, "<").replace(/>/g, ">");
 | 
			
		||||
            textEdit.replace(selection, transformed);
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue