File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed
Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -2017,15 +2017,20 @@ Used to prevent repeated warnings for the same invalid pattern.")
20172017 "Return the first regex, if any, within REGEX-LIST matching STR.
20182018Returns the matching regex string on success, nil on no match or invalid regex.
20192019Invalid regex patterns are logged as warnings (once per pattern) and skipped."
2020- (--first (condition-case err
2021- (string-match it str)
2022- (invalid-regexp
2023- (unless (gethash it lsp--warned-invalid-regexps)
2024- (puthash it t lsp--warned-invalid-regexps)
2025- (lsp-warn "Invalid regexp in watch pattern: %s (parsing %s)"
2026- (error-message-string err) it))
2027- nil))
2028- regex-list))
2020+ (let (result)
2021+ (while regex-list
2022+ (let ((re (car regex-list)))
2023+ (setq regex-list (cdr regex-list))
2024+ (condition-case err
2025+ (when (string-match-p re str)
2026+ (setq result re
2027+ regex-list nil))
2028+ (invalid-regexp
2029+ (unless (gethash re lsp--warned-invalid-regexps)
2030+ (puthash re t lsp--warned-invalid-regexps)
2031+ (lsp-warn "Invalid regexp in watch pattern: %s (parsing %s)"
2032+ (error-message-string err) re))))))
2033+ result))
20292034
20302035(cl-defstruct lsp-watch
20312036 (descriptors (make-hash-table :test 'equal))
You can’t perform that action at this time.
0 commit comments