Reputation: 11
How can I (properly) use the locally downloaded types of my supabase db for use in an Edge Functions environment (Deno) to provide autocomplete suggestions in VS Code?
I tried doing it similarly to how it was done in my react supabase:
import "jsr:@supabase/functions-js/edge-runtime.d.ts"
import { createClient, SupabaseClient } from 'jsr:@supabase/supabase-js@2'
import { Database } from "../_types/supabase.ts";
const supabase = createClient<Database>(
Deno.env.get('SUPABASE_URL') ?? '',
Deno.env.get('SUPABASE_ANON_KEY') ?? '',
{ global: { headers: { Authorization: req.headers.get('Authorization')! } } }
)
But it doesn't seem to be working as VS Code isn't suggesting an autocomplete of my tables if I type it.
Upvotes: 1
Views: 821
Reputation: 2356
Ok after lots of work, and trying everything from this github discussion, the thing that immediately worked for me was opening my supabase-functions workspace directly, in a new vs-code window.
Definitely need the vscode deno extension.
So the folder that contains .vscode/settings.json
and my supabase/functions
folders. Is a specific project/workspace. The intellisense doesn't scope to that directories settings - if it is contained inside a larger project, and you open that project's higher parent folder, then drill down into these supabase functions.
You have to specifically open vscode to the folder with your supabase/
directory. Worked on my machine.
Upvotes: 1