How to set up a language server

I’m very sorry, I’m new to lua and I don’t know how the language server is set up, like:

root_dir = function(startpath)
    return M.search_ancestors(startpath, matcher)
end

I would like to know how to get this function M.search_ancestors.

Do matcher and startpath need other settings?

Do I need to import any package? Where are these functions located?

I’m surprised you need to import that function, it’s typically not used in user configs.

local util = require('lspconfig.util') 
util.search_ancestors(startpath, matcher)

You don’t need to touch that function (usually), it’s called by root_pattern (which most people do not need to modify anyways.

thank you, i think i know how to use it