Migrate from deprecated text document (#781)

* Removed instances of deprecated TextDocument

* Replaced TextDocument type in diagnostics
master
Max 2023-05-15 12:21:43 +02:00 committed by GitHub
parent 460d921ca3
commit 35b9d115bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 36 additions and 22 deletions

View File

@ -1,4 +1,4 @@
import { TextDocument } from 'vscode-languageserver/node'
import type { TextDocument } from 'vscode-languageserver-textdocument'
import { State } from 'tailwindcss-language-service/src/util/state'
import { doValidate } from 'tailwindcss-language-service/src/diagnostics/diagnosticsProvider'
import isExcluded from '../util/isExcluded'

View File

@ -1,7 +1,7 @@
import minimatch from 'minimatch'
import * as path from 'path'
import type { TextDocument } from 'vscode-languageserver-textdocument'
import { State } from 'tailwindcss-language-service/src/util/state'
import { TextDocument } from 'vscode-languageserver-textdocument'
import { getFileFsPath } from './uri'
export default async function isExcluded(

View File

@ -1,4 +1,5 @@
import type { CodeAction, CodeActionParams } from 'vscode-languageserver'
import type { TextDocument } from 'vscode-languageserver-textdocument'
import { State } from '../util/state'
import { doValidate } from '../diagnostics/diagnosticsProvider'
import { rangesEqual } from '../util/rangesEqual'
@ -17,7 +18,6 @@ import { flatten, dedupeBy } from '../util/array'
import { provideCssConflictCodeActions } from './provideCssConflictCodeActions'
import { provideInvalidApplyCodeActions } from './provideInvalidApplyCodeActions'
import { provideSuggestionCodeActions } from './provideSuggestionCodeActions'
import { TextDocument } from 'vscode-languageserver-textdocument'
async function getDiagnosticsFromCodeActionParams(
state: State,

View File

@ -5,10 +5,10 @@ import type {
Range,
MarkupKind,
CompletionList,
TextDocument,
Position,
CompletionContext,
} from 'vscode-languageserver'
import type { TextDocument } from 'vscode-languageserver-textdocument'
import dlv from 'dlv'
import removeMeta from './util/removeMeta'
import { getColor, getColorFromValue } from './util/color'

View File

@ -1,4 +1,4 @@
import type { TextDocument } from 'vscode-languageserver'
import type { TextDocument } from 'vscode-languageserver-textdocument'
import { State } from '../util/state'
import { DiagnosticKind, AugmentedDiagnostic } from './types'
import { getCssConflictDiagnostics } from './getCssConflictDiagnostics'

View File

@ -1,6 +1,5 @@
import { joinWithAnd } from '../util/joinWithAnd'
import { State, Settings } from '../util/state'
import type { TextDocument } from 'vscode-languageserver'
import { CssConflictDiagnostic, DiagnosticKind } from './types'
import { findClassListsInDocument, getClassNamesInClassList } from '../util/find'
import { getClassNameDecls } from '../util/getClassNameDecls'
@ -8,6 +7,7 @@ import { getClassNameMeta } from '../util/getClassNameMeta'
import { equal } from '../util/array'
import * as jit from '../util/jit'
import type { AtRule, Node, Rule } from 'postcss'
import type { TextDocument } from 'vscode-languageserver-textdocument'
function isCustomProperty(property: string): boolean {
return property.startsWith('--')

View File

@ -1,7 +1,8 @@
import type { TextDocument } from 'vscode-languageserver-textdocument'
import { findClassNamesInRange } from '../util/find'
import { InvalidApplyDiagnostic, DiagnosticKind } from './types'
import { Settings, State } from '../util/state'
import type { TextDocument, DiagnosticSeverity } from 'vscode-languageserver'
import type { DiagnosticSeverity } from 'vscode-languageserver'
import { validateApply } from '../util/validateApply'
export async function getInvalidApplyDiagnostics(

View File

@ -1,5 +1,4 @@
import { State, Settings } from '../util/state'
import type { TextDocument } from 'vscode-languageserver'
import { InvalidConfigPathDiagnostic, DiagnosticKind } from './types'
import { findHelperFunctionsInDocument } from '../util/find'
import { stringToPath } from '../util/stringToPath'
@ -7,6 +6,7 @@ import isObject from '../util/isObject'
import { closest } from '../util/closest'
import { combinations } from '../util/combinations'
import dlv from 'dlv'
import type { TextDocument } from 'vscode-languageserver-textdocument'
function pathToString(path: string | string[]): string {
if (typeof path === 'string') return path

View File

@ -1,5 +1,6 @@
import { State, Settings } from '../util/state'
import type { TextDocument, Range, DiagnosticSeverity } from 'vscode-languageserver'
import type { Range, DiagnosticSeverity } from 'vscode-languageserver'
import type { TextDocument } from 'vscode-languageserver-textdocument'
import { InvalidScreenDiagnostic, DiagnosticKind } from './types'
import { isCssDoc } from '../util/css'
import { getLanguageBoundaries } from '../util/getLanguageBoundaries'

View File

@ -1,5 +1,6 @@
import { State, Settings } from '../util/state'
import type { TextDocument, Range, DiagnosticSeverity } from 'vscode-languageserver'
import type { Range, DiagnosticSeverity } from 'vscode-languageserver'
import type { TextDocument } from 'vscode-languageserver-textdocument'
import { InvalidTailwindDirectiveDiagnostic, DiagnosticKind } from './types'
import { isCssDoc } from '../util/css'
import { getLanguageBoundaries } from '../util/getLanguageBoundaries'

View File

@ -1,5 +1,6 @@
import { State, Settings } from '../util/state'
import type { TextDocument, Range, DiagnosticSeverity } from 'vscode-languageserver'
import type { Range, DiagnosticSeverity } from 'vscode-languageserver'
import type { TextDocument } from 'vscode-languageserver-textdocument'
import { InvalidVariantDiagnostic, DiagnosticKind } from './types'
import { isCssDoc } from '../util/css'
import { getLanguageBoundaries } from '../util/getLanguageBoundaries'

View File

@ -1,5 +1,5 @@
import type { TextDocument } from 'vscode-languageserver-textdocument'
import { State, Settings } from '../util/state'
import type { TextDocument } from 'vscode-languageserver'
import { RecommendedVariantOrderDiagnostic, DiagnosticKind } from './types'
import { findClassListsInDocument, getClassNamesInClassList } from '../util/find'
import * as jit from '../util/jit'

View File

@ -6,7 +6,8 @@ import {
} from './util/find'
import { getColor, getColorFromValue, culoriColorToVscodeColor } from './util/color'
import { stringToPath } from './util/stringToPath'
import type { TextDocument, ColorInformation } from 'vscode-languageserver'
import type { ColorInformation } from 'vscode-languageserver'
import type { TextDocument } from 'vscode-languageserver-textdocument'
import dlv from 'dlv'
import { dedupeByRange } from './util/array'

View File

@ -1,5 +1,6 @@
import type { TextDocument } from 'vscode-languageserver-textdocument'
import { State } from './util/state'
import type { DocumentLink, Range, TextDocument } from 'vscode-languageserver'
import type { DocumentLink, Range } from 'vscode-languageserver'
import { isCssDoc } from './util/css'
import { getLanguageBoundaries } from './util/getLanguageBoundaries'
import { findAll, indexToPosition } from './util/find'

View File

@ -1,5 +1,5 @@
import { State } from './util/state'
import type { Hover, TextDocument, Position } from 'vscode-languageserver'
import type { Hover, Position } from 'vscode-languageserver'
import { stringifyCss, stringifyConfigValue } from './util/stringify'
import dlv from 'dlv'
import { isCssContext } from './util/css'
@ -9,6 +9,7 @@ import { getClassNameParts } from './util/getClassNameAtPosition'
import * as jit from './util/jit'
import { validateConfigPath } from './diagnostics/getInvalidConfigPathDiagnostics'
import { isWithinRange } from './util/isWithinRange'
import type { TextDocument } from 'vscode-languageserver-textdocument'
export async function doHover(
state: State,

View File

@ -1,4 +1,5 @@
import type { TextDocument, Position } from 'vscode-languageserver'
import type { Position } from 'vscode-languageserver'
import type { TextDocument } from 'vscode-languageserver-textdocument'
import { isVueDoc, isSvelteDoc, isHtmlDoc } from './html'
import { isJsDoc } from './js'
import { State } from './state'

View File

@ -1,4 +1,5 @@
import type { TextDocument, Range } from 'vscode-languageserver'
import type { Range } from 'vscode-languageserver'
import type { TextDocument } from 'vscode-languageserver-textdocument'
import moo from 'moo'
export function getTextWithoutComments(

View File

@ -1,4 +1,5 @@
import type { TextDocument, Range, Position } from 'vscode-languageserver'
import type { Range, Position } from 'vscode-languageserver'
import type { TextDocument } from 'vscode-languageserver-textdocument'
import { DocumentClassName, DocumentClassList, State, DocumentHelperFunction } from './state'
import lineColumn from 'line-column'
import { isCssContext, isCssDoc } from './css'

View File

@ -1,4 +1,5 @@
import type { TextDocument, Range } from 'vscode-languageserver'
import type { Range } from 'vscode-languageserver'
import type { TextDocument } from 'vscode-languageserver-textdocument'
import { isVueDoc, isHtmlDoc, isSvelteDoc } from './html'
import { State } from './state'
import { indexToPosition } from './find'

View File

@ -1,4 +1,5 @@
import type { TextDocument, Position } from 'vscode-languageserver'
import type { Position } from 'vscode-languageserver'
import type { TextDocument } from 'vscode-languageserver-textdocument'
import { State } from './state'
import { htmlLanguages } from './languages'
import { getLanguageBoundaries } from './getLanguageBoundaries'

View File

@ -1,4 +1,5 @@
import type { TextDocument, Range, Position } from 'vscode-languageserver'
import type { TextDocument } from 'vscode-languageserver-textdocument'
import type { Range, Position } from 'vscode-languageserver'
export function isValidLocationForEmmetAbbreviation(
document: TextDocument,

View File

@ -1,4 +1,5 @@
import type { TextDocument, Position } from 'vscode-languageserver'
import type { Position } from 'vscode-languageserver'
import type { TextDocument } from 'vscode-languageserver-textdocument'
import { State } from './state'
import { jsLanguages } from './languages'
import { getLanguageBoundaries } from './getLanguageBoundaries'