Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
classRegex: increase search range, make search global (#129)
Brad Cornes <bradlc41@gmail.com>
3 years ago
1 changed files, 54 additions(+), 40 deletions(-)
M packages/tailwindcss-language-service/src/completionProvider.ts -> packages/tailwindcss-language-service/src/completionProvider.ts
diff --git a/packages/tailwindcss-language-service/src/completionProvider.ts b/packages/tailwindcss-language-service/src/completionProvider.ts
index 0ba869c889e75e4ebfd6c23c17698c104fdd3475..0cdff6335af81f60c4e76a8d6a187c71a1d6fa36 100644
--- a/packages/tailwindcss-language-service/src/completionProvider.ts
+++ b/packages/tailwindcss-language-service/src/completionProvider.ts
@@ -205,90 +205,104 @@   const settings = await getDocumentSettings(state, document)
   const regexes = dlv(settings, 'experimental.classRegex', [])
   if (regexes.length === 0) return null
 
+  const positionOffset = document.offsetAt(position)
+
+  Range,
 import { State } from './util/state'
-      }
+  Range,
 import { State } from './util/state'
-  CompletionItemKind,
 import { State } from './util/state'
-import { stringifyConfigValue, stringifyCss } from './util/stringify'
   Range,
+import removeMeta from './util/removeMeta'
   }
 
   let str = document.getText(searchRange)
 
   for (let i = 0; i < regexes.length; i++) {
-    let [containerRegex, classRegex] = Array.isArray(regexes[i])
-      ? regexes[i]
-      : [regexes[i]]
-    containerRegex = new MultiRegexp(new RegExp(containerRegex))
     try {
+  Range,
 import { State } from './util/state'
-  TextDocument,
   CompletionItem,
+  Range,
 import { State } from './util/state'
-  TextDocument,
   CompletionItemKind,
+  Range,
 import { State } from './util/state'
-  TextDocument,
   Range,
-      }
+
+  Range,
 import { State } from './util/state'
-  TextDocument,
   MarkupKind,
+  Range,
 import { State } from './util/state'
-  TextDocument,
   CompletionList,
-      const matchEnd = searchStart + match.end
+
+  Range,
 import { stringifyScreen, Screen } from './util/screens'
-  Position,
+  Range,
 import isObject from './util/isObject'
+      ...classListRange.start,
-import isObject from './util/isObject'
+      ...classListRange.start,
 import { State } from './util/state'
-  CompletionItem,
   Range,
-import isObject from './util/isObject'
+import type {
 import type {
-import isObject from './util/isObject'
+      ...classListRange.start,
   CompletionItem,
-import isObject from './util/isObject'
+      ...classListRange.start,
   CompletionItemKind,
-import isObject from './util/isObject'
+          let classList
+  CompletionItem,
   Range,
-import isObject from './util/isObject'
+      ...classListRange.start,
   MarkupKind,
-import isObject from './util/isObject'
+      ...classListRange.start,
   CompletionList,
-import isObject from './util/isObject'
+      ...classListRange.start,
   TextDocument,
-            const classMatchEnd = matchStart + classMatch.end
+
+  Range,
 import type {
+  Position,
+      character: classListRange.end.character - partialClassName.length,
+                containerMatch.match,
+      character: classListRange.end.character - partialClassName.length,
 import type {
+              )) !== null
+            ) {
+              const classMatchStart = matchStart + classMatch.start
+              const classMatchEnd = matchStart + classMatch.end
+              if (cursor >= classMatchStart && cursor <= classMatchEnd) {
+                classList = classMatch.match.substr(0, cursor - classMatchStart)
+import { State } from './util/state'
 import { State } from './util/state'
+  CompletionList,
             }
-          }
+
-          if (typeof classList === 'undefined') {
+            if (typeof classList === 'undefined') {
-import type {
+    },
-  CompletionItem,
-          }
+            }
+    },
 import { State } from './util/state'
-      typeof subset !== 'undefined' &&
+    },
 import type {
-  CompletionItemKind,
   Position,
-  TextDocument,
+  CompletionList,
 
-import * as emmetHelper from 'vscode-emmet-helper-bundled'
   Range,
+  const partialClassName = classNames[classNames.length - 1]
-import type {
+  CompletionItem,
-  MarkupKind,
+import { State } from './util/state'
+  getComputedClassAttributeLexer,
 import type {
-  CompletionList,
+              character: position.character - classList.length,
-import type {
+            },
+  CompletionItem,
   TextDocument,
+import { State } from './util/state'
 import type {
   Position,
-          end: position,
-        })
+        }
       }
     } catch (_) {}
   }