volarjs / volar.js

💙🌊
https://volarjs.dev/
MIT License
963 stars 47 forks source link

refactor(monaco): replace `activateAutomaticTypeAcquisition` with `createNpmFileSystem` #218

Closed johnsoncodehk closed 2 months ago

johnsoncodehk commented 2 months ago

The activateAutomaticTypeAcquisition function has been removed, createNpmFileSystem should now be used instead in v2.4.

Example

import { createNpmFileSystem } from '@volar/jsdelivr';

const env: LanguageServiceEnvironment = {
  workspaceFolders: [URI.file('/')],
  locale,
  fs: createNpmFileSystem(
    uri => {
      if (uri.scheme === 'file') {
        if (uri.path === '/node_modules') {
          return ''
        }
        else if (uri.path.startsWith('/node_modules/')) {
          return uri.path.substring('/node_modules/'.length)
        }
      }
    }
  )
};