Restrict Visual Studio 2019 to allow only latin characters in code - visual-studio-2019

How can I restrict Visual Studio 2019 to allow only latin characters in identifiers? That means, I want method names and variable names to be in latin characters, and not for example in greek characters. The following code compiles in Visual Studio 2019:
Module Module1
Private Sub MethodLatin()
Console.WriteLine("MethodLatin")
End Sub
Private Sub ΜέθοδοςΕλληνική()
Dim αβγ = "ΜέθοδοςΕλληνική"
Console.WriteLine(αβγ)
End Sub
Sub Main()
MethodLatin()
ΜέθοδοςΕλληνική()
Console.ReadKey()
End Sub
End Module
I would like to forbid to write the second method (ΜέθοδοςΕλληνική) in greek characters. How can I do that?

Related

I want to change my ; semicolon to , coma in windows form properties in visual studio 2019

This is the properties window and as you can see in the highlighted line the semicolon between the numbers and I want to change it to comma as default.
My VS uses , rather than ; for Size etc. If you click start, type control, open control panel, search region, open it and click additional, what does your window look like?
Mine looks like:
If I change "list separator" to ; then my VS looks like yours (after I restart it)

How to include a colon in a Visual Studio extension DisplayName

I'd like to use a colon (:) as part of my extension's DisplayName. I've modified my .vsixmanifest file as such:
<DisplayName>Foo:Bar & Baz</DisplayName>
But, at build time I get an error:
Error trying to read the VSIX manifest file "obj\x86\Debug\extension.vsixmanifest".
The given path's format is not supported.
The docs say nothing about any character limitation, only that DisplayName must be less than 50 characters.
I've even tried encoding the colon, but I get the same error message (above).
<DisplayName>Foo:Bar & Baz</DisplayName>
Is there anyway around this?
How to include a colon in a Visual Studio extension DisplayName
I am afraid that you cannot get what you want.
Colon is an illegal character in the vsixmanifest file and therefore cannot be used in it.
Suggestion
We suggest you could use _ rather than :.
In addition, if you still want this feature, you could suggest this feature on our User Voice Forum.

F#: Why does script file not recognize module?

I create a new F# console application project in Visual Studio 2015
I create a simple new module file called Calc.fs like so:
module Calc
let add a b = a + b
I add an F# script file to the project like so:
open Calc
let c = add 1 2
I get the following compiler errors in the script file:
The namespace or module 'Calc' is not defined
and
The value or constructor 'add' is not defined
Why is my module not recognized by my script file? How can I fix this?
Please note that my script file appears after the module in the order of files in the project:
.fsx files are not compiled together with the rest of the project; they don't "know" about any other code unless you explicitly make it known to them. This is true for any external DLLs (and in fact even many in the .NET Framework) as well as other F# code.
You need to add
#load "Calc.fs"
at the top of the script file to tell the compiler to load that code before evaluating the rest of the script.

How do I fix the generator for Resource.Designer.fs so that it escapes language keywords?

Create a blank Android app from the F# template in Visual Studio.
Add the Xamarin.Forms NuGet package.
Build the project.
The build fails because of this line in Resource.Designer.fs:
static member end = 2131165212
Because end is a keyword in F#, the error reads "Unexpected keyword 'end' in member definition".
There is a fix: you can replace end as follows:
static member ``end`` = 2131165212
However, Resource.Designer.fs is a generated file, so I have to keep doing this.
How is this file generated? How would I go about making a pull request to fix this bug?

How to identify redefined variables or shadowed variables

When using the same variable twice in the same scope with the F# compiler there is no warning or feedback. e.g.
let s = "abc"
let s = "def"
printfn "%A" s
results in
def
I have seen
Is there a way to have warnings for shadowing values in F# in Visual Studio?
F# value shadowing - is it possible to disable value shadowing within the same scope
Is there a way to get feedback about shadowed variables either by a compiler warning or visually in the editor. How can this be done?
First off, shadowing of variables in the same scope is not a bug or something that should be disabled. As Joel Mueller states it is legitimate, useful, and common.
Per MSDN
At any level of scope other than module scope, it is not an error to
reuse a value or function name. If you reuse a name, the name declared
later shadows the name declared earlier.
The Syntax Coloring feature of the Visual Studio extension F# Power Tools will highlight the current valid variable and show the shadowed variables as a light grey. e.g.
The extension can be installed from Visual Studio menu
Tools -> Extensions and Updates
Once the dialog opens
Select Visual Studio Gallery
In the upper right search box enter F# Power Tools
Since I have already installed it, the option to install is not shown.
The feature can be activated from the Visual Studio menu
Tools -> Options -> F# Power Tools -> General -> Syntax Coloring -> Grey out unused declarations
With option off:
with option on:
Note: After changing the option the source file(s) must be closed and then reopened for the change to take effect. Visual Studio does not need to be restarted for this but doing so will have the same effect.
Thanks to Ringil for noting my earlier invalid statement.
Note from source code:
Graying out unused declarations
Currently unused non public types, methods, functions and values declarations are checked. Beware that this
feature is only 100% reliable when the code has no type error. This
setting is available in General options. It is disabled by default
because there might be performance issues on large files.
F# Power Tools features list

Resources