ensureServerForFile method

Future<LspServerInstance?> ensureServerForFile(
  1. String filePath
)

Ensure a server is started for the given file.

Implementation

Future<LspServerInstance?> ensureServerForFile(String filePath) async {
  final config = configForFile(filePath);
  if (config == null) return null;

  final existing = _servers[config.name];
  if (existing != null && existing.state == LspServerState.running) {
    return existing;
  }

  return _startServer(config);
}