Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vscode error] Request textDocument/hover failed #207

Closed
replygirl opened this issue May 25, 2021 · 3 comments
Closed

[vscode error] Request textDocument/hover failed #207

replygirl opened this issue May 25, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@replygirl
Copy link

replygirl commented May 25, 2021

The error

This happens very time I hover over a specific symbol:

Request textDocument/hover failed.
  Message: Request textDocument/hover failed with message: (tag.text || "").split is not a function
  Code: -32603 

Sample code

Affected component:

The affected new CoordinateSpan(...) symbol is labeled near the bottom of the <script> tag

<!-- @/components/Map.vue -->

<template lang="pug">
div(ref="mapContainer")
</template>

<script setup lang="ts">
import { inject, onMounted, ref } from 'vue'

const maps = inject<typeof mapkit>('mapkit')
const mapContainer = ref<HTMLDivElement | null>(null)
const map = ref<mapkit.Map | null>(null)

onMounted(() => {
  if (import.meta.env.SSR) return
  if (maps == null) throw new Error('MapKit is not available')
  if (mapContainer.value == null)
    throw new Error('Map container has not mounted')

  console.info(mapContainer.value)

  const { Coordinate, CoordinateRegion, CoordinateSpan, Map, MapRect } = maps!

  map.value = new Map(mapContainer.value!, {
    visibleMapRect: new MapRect(-73.979187, 40.705628, 1, 1),
    region: new CoordinateRegion(
      new Coordinate(-73.979187, 40.705628),
      new CoordinateSpan(0.692826, 0.210573) // this is the affected symbol
    ),
    center: new Coordinate(-73.979187, 40.705628),
  })
})
</script>

MapKit provider

// @/modules/mapkit.ts

import type { UserModule } from '@/types'

// Events: https://developer.apple.com/documentation/mapkitjs/mapkit/map/handling_map_events

// Types: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/apple-mapkit-js-browser/index.d.ts

export const install: UserModule = ({ app, isClient }) => {
  app.provide<typeof mapkit | null>('mapkit', isClient ? mapkit : null)

  if (isClient)
    mapkit.init({
      authorizationCallback: done =>
        done(import.meta.env.VITE_APP_APPLE_MAPKIT_TOKEN as string),
    })
}

Context:

  • The project is loosely based on frandiox/vitesse-ssr-template
  • In tsconfig.json, register mapkit by adding apple-mapkit-js-browser to compilerOptions.types
  • The offending type is fully documented and can be jumped to with alt+click just like the other types from mapkit
  • The component compiles without type errors
@replygirl replygirl changed the title Request textDocument/hover failed [vscode error] Request textDocument/hover failed May 25, 2021
@replygirl
Copy link
Author

This appears to be semi-random, it's affecting more commonly used symbols like onClickOutside imported from @vueuse/core

@johnsoncodehk johnsoncodehk added the bug Something isn't working label May 25, 2021
@johnsoncodehk
Copy link
Member

Can this problem reproduce in v0.25.14?

If yes please try to provide a out of the box minimal reproduction. 😅

@johnsoncodehk
Copy link
Member

Fixed in 0.25.17.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants