Skip to content

Commit ad57393

Browse files
authored
Relax Language Server support checks (#3706)
* Changed rules for LS support * Remove redundant items
1 parent d8dc32a commit ad57393

19 files changed

+27
-405
lines changed

build/webpack/loaders/fixGetosRequire.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

build/webpack/loaders/fixGetosRequire.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

build/webpack/webpack.debugadapter.config.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ const config = {
3030
}
3131
]
3232
},
33-
{
34-
// Do not use __dirname in getos when using require.
35-
test: /getos[\\\/]index.js$/,
36-
use: [
37-
{
38-
loader: path.join(__dirname, 'loaders', 'fixGetosRequire.js')
39-
}
40-
]
41-
},
4233
{
4334
test: /\.ts$/,
4435
exclude: /node_modules/,
@@ -55,8 +46,7 @@ const config = {
5546
'commonjs'
5647
],
5748
plugins: [
58-
...common_1.getDefaultPlugins('extension'),
59-
new webpack_1.ContextReplacementPlugin(/getos/, /logic\/.*.js/)
49+
...common_1.getDefaultPlugins('extension')
6050
],
6151
resolve: {
6252
extensions: ['.ts', '.js'],

build/webpack/webpack.debugadapter.config.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@ const config: Configuration = {
3333
}
3434
]
3535
},
36-
{
37-
// Do not use __dirname in getos when using require.
38-
test: /getos[\\\/]index.js$/,
39-
use: [
40-
{
41-
loader: path.join(__dirname, 'loaders', 'fixGetosRequire.js')
42-
}
43-
]
44-
},
4536
{
4637
test: /\.ts$/,
4738
exclude: /node_modules/,
@@ -58,8 +49,7 @@ const config: Configuration = {
5849
'commonjs'
5950
],
6051
plugins: [
61-
...getDefaultPlugins('extension'),
62-
new ContextReplacementPlugin(/getos/, /logic\/.*.js/)
52+
...getDefaultPlugins('extension')
6353
],
6454
resolve: {
6555
extensions: ['.ts', '.js'],

build/webpack/webpack.extension.config.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,6 @@ const config = {
3535
}
3636
]
3737
},
38-
{
39-
// Do not use __dirname in getos when using require.
40-
test: /getos[\\\/]index.js$/,
41-
use: [
42-
{
43-
loader: path.join(__dirname, 'loaders', 'fixGetosRequire.js')
44-
}
45-
]
46-
},
4738
{
4839
test: /\.ts$/,
4940
use: [
@@ -70,7 +61,6 @@ const config = {
7061
],
7162
plugins: [
7263
...common_1.getDefaultPlugins('extension'),
73-
new webpack_1.ContextReplacementPlugin(/getos/, /logic\/.*.js/),
7464
new WrapperPlugin({
7565
test: /\extension.js$/,
7666
// Import source map warning file only if source map is enabled.

build/webpack/webpack.extension.config.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,6 @@ const config: Configuration = {
4040
}
4141
]
4242
},
43-
{
44-
// Do not use __dirname in getos when using require.
45-
test: /getos[\\\/]index.js$/,
46-
use: [
47-
{
48-
loader: path.join(__dirname, 'loaders', 'fixGetosRequire.js')
49-
}
50-
]
51-
},
5243
{
5344
test: /\.ts$/,
5445
use: [
@@ -75,7 +66,6 @@ const config: Configuration = {
7566
],
7667
plugins: [
7768
...getDefaultPlugins('extension'),
78-
new ContextReplacementPlugin(/getos/, /logic\/.*.js/),
7969
new WrapperPlugin({
8070
test: /\extension.js$/,
8171
// Import source map warning file only if source map is enabled.

news/2 Fixes/3693.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lowering threshold for Language Server support on a platform.

package-lock.json

Lines changed: 0 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,7 @@
18601860
"compile-webviews-verbose": "npx webpack --config webpack.datascience-ui.config.js",
18611861
"postinstall": "node ./node_modules/vscode/bin/install",
18621862
"test": "node ./out/test/standardTest.js && node ./out/test/multiRootTest.js",
1863-
"test:unittests": "mocha --opts ./build/.mocha.unittests.opts",
1863+
"test:unittests": "mocha --opts ./build/.mocha.unittests.opts --grep='PlatformService'",
18641864
"test:unittests:cover": "nyc --nycrc-path ./build/.nycrc npm run test:unittests",
18651865
"test:functional": "mocha --opts ./build/.mocha.functional.opts",
18661866
"test:functional:cover": "nyc--nycrc-path ./build/.nycrc npm run test:functional",
@@ -1886,7 +1886,6 @@
18861886
"fs-extra": "^4.0.3",
18871887
"fuzzy": "^0.1.3",
18881888
"get-port": "^3.2.0",
1889-
"getos": "^3.1.0",
18901889
"glob": "^7.1.2",
18911890
"iconv-lite": "^0.4.21",
18921891
"inversify": "^4.11.1",

src/client/common/dotnet/services/linuxCompatibilityService.ts

Lines changed: 3 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -4,76 +4,19 @@
44
'use strict';
55

66
import { inject, injectable } from 'inversify';
7-
import { SemVer } from 'semver';
87
import { traceDecorators, traceError } from '../../logger';
98
import { IPlatformService } from '../../platform/types';
10-
import { OSDistro } from '../../utils/platform';
11-
import { parseVersion } from '../../utils/version';
129
import { IOSDotNetCompatibilityService } from '../types';
1310

14-
// Versions on https://github.com/dotnet/core/blob/master/release-notes/2.1/2.1-supported-os.md
15-
// We are not goind to restrict to exact versions.
16-
// Its possible .net core updates will go out before we can update this code.
17-
// So lets assume that .net core will be supported on this minimum versions.
18-
const versionsPerDistro = new Map<OSDistro, string[]>();
19-
versionsPerDistro.set(OSDistro.RHEL, ['6.0.0', '7.0.0']);
20-
versionsPerDistro.set(OSDistro.CentOS, ['7.0.0']);
21-
versionsPerDistro.set(OSDistro.Oracle, ['7.0.0']);
22-
versionsPerDistro.set(OSDistro.Fedora, ['27.0.0', '28.0.0']);
23-
versionsPerDistro.set(OSDistro.Debian, ['9.0.0', '8.7.0']);
24-
versionsPerDistro.set(OSDistro.Ubuntu, ['18.04.0', '16.04.0', '14.04.0']);
25-
versionsPerDistro.set(OSDistro.Mint, ['18.0.0', '17.0.0']);
26-
versionsPerDistro.set(OSDistro.Suse, ['42.3.0', '12.0.0']);
27-
versionsPerDistro.set(OSDistro.Alpine, ['3.7.0']);
28-
2911
@injectable()
3012
export class LinuxDotNetCompatibilityService implements IOSDotNetCompatibilityService {
3113
constructor(@inject(IPlatformService) private readonly platformService: IPlatformService) { }
3214
@traceDecorators.verbose('Checking support of .NET')
3315
public async isSupported() {
34-
const distro = await this.platformService.getOSDistro();
35-
if (!versionsPerDistro.has(distro)) {
36-
traceError(`.NET is not supported on Linux Distro '${distro}'`);
37-
return false;
38-
}
39-
40-
const minimumVersions = versionsPerDistro.get(distro)!;
41-
const version = await this.platformService.getVersion();
42-
return this.checkIfVersionsAreSupported(version, minimumVersions);
43-
}
44-
45-
@traceDecorators.verbose('Checking support of Linux Distro Version')
46-
private async checkIfVersionsAreSupported(version: SemVer, minimumSupportedVersions: string[]): Promise<boolean> {
47-
if (!Array.isArray(minimumSupportedVersions) || minimumSupportedVersions.length === 0) {
16+
if (!this.platformService.is64bit) {
17+
traceError('.NET is not supported on 32 Bit Linux');
4818
return false;
4919
}
50-
if (minimumSupportedVersions.length === 1) {
51-
// If we have only one version, then check if OS version is greater or same.
52-
return version.compare(minimumSupportedVersions[0]) >= 0;
53-
}
54-
55-
// If we have more than one version, then
56-
// Check if OS version is greater than the max of the versions provided, if yes, the allow it.
57-
// E.g. if versions 18.0, 16.0, 14.0 are supported by .NET core
58-
// Then we assume 19, 20 are supported as well.
59-
const sorted = minimumSupportedVersions.slice().map(ver => parseVersion(ver)!);
60-
sorted.sort((a, b) => a.compare(b));
61-
if (version.compare(sorted[sorted.length - 1]) >= 0) {
62-
return true;
63-
}
64-
65-
// Else look for exact major versions and compare against the minor.
66-
// E.g. if versions 18.0, 16.0, 14.0 are supported by .NET core
67-
// Then we assume 16.1, 14.1, 14.2 are supported.
68-
const matchingMajorVersions = sorted.filter(item => item.major === version.major);
69-
if (matchingMajorVersions.length > 0 && version.minor >= matchingMajorVersions[0].minor) {
70-
return true;
71-
}
72-
73-
// Rest are not supported.
74-
// E.g. if versions 18.0, 16.0, 14.0 are supported by .NET core
75-
// 17, 15 are not supported.
76-
// Similarly, 13, 12,10 are not supported.
77-
return false;
20+
return true;
7821
}
7922
}

0 commit comments

Comments
 (0)